Title: [149495] trunk/Source/WebCore
Revision
149495
Author
[email protected]
Date
2013-05-02 13:56:41 -0700 (Thu, 02 May 2013)

Log Message

Simplify WebCoreObjCExtras by using WTF::bind
https://bugs.webkit.org/show_bug.cgi?id=115524

Reviewed by Andreas Kling.

* platform/mac/WebCoreObjCExtras.mm:
(deallocCallback):
(WebCoreObjCScheduleDeallocateOnMainThread):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149494 => 149495)


--- trunk/Source/WebCore/ChangeLog	2013-05-02 20:43:02 UTC (rev 149494)
+++ trunk/Source/WebCore/ChangeLog	2013-05-02 20:56:41 UTC (rev 149495)
@@ -1,3 +1,14 @@
+2013-05-02  Anders Carlsson  <[email protected]>
+
+        Simplify WebCoreObjCExtras by using WTF::bind
+        https://bugs.webkit.org/show_bug.cgi?id=115524
+
+        Reviewed by Andreas Kling.
+
+        * platform/mac/WebCoreObjCExtras.mm:
+        (deallocCallback):
+        (WebCoreObjCScheduleDeallocateOnMainThread):
+
 2013-05-02  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/13740375> Non-ASCII downloaded file names are garbled when using NetworkProcess

Modified: trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm (149494 => 149495)


--- trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm	2013-05-02 20:43:02 UTC (rev 149494)
+++ trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm	2013-05-02 20:56:41 UTC (rev 149495)
@@ -37,6 +37,7 @@
 #include <objc/objc-auto.h>
 #include <utility>
 #include <wtf/Assertions.h>
+#include <wtf/Functional.h>
 #include <wtf/MainThread.h>
 #include <wtf/ObjcRuntimeExtras.h>
 #include <wtf/Threading.h>
@@ -53,19 +54,12 @@
 #endif
 }
 
-
-typedef std::pair<Class, id> ClassAndIdPair;
-
-static void deallocCallback(void* context)
+static void deallocCallback(Class cls, id object)
 {
-    ClassAndIdPair* pair = static_cast<ClassAndIdPair*>(context);
-    
-    Method method = class_getInstanceMethod(pair->first, @selector(dealloc));
-    
+    Method method = class_getInstanceMethod(cls, @selector(dealloc));
+
     IMP imp = method_getImplementation(method);
-    wtfCallIMP<void>(imp, pair->second, @selector(dealloc));
-    
-    delete pair;
+    wtfCallIMP<void>(imp, object, @selector(dealloc));
 }
 
 bool WebCoreObjCScheduleDeallocateOnMainThread(Class cls, id object)
@@ -74,9 +68,8 @@
 
     if (isMainThread())
         return false;
-    
-    ClassAndIdPair* pair = new ClassAndIdPair(cls, object);
-    callOnMainThread(deallocCallback, pair);
+
+    callOnMainThread(bind(deallocCallback, cls, object));
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to