Title: [102797] trunk/Source
Revision
102797
Author
[email protected]
Date
2011-12-14 10:36:45 -0800 (Wed, 14 Dec 2011)

Log Message

Add back the callOnMainThread overload that takes a WTF::Function
https://bugs.webkit.org/show_bug.cgi?id=74512

Reviewed by Darin Adler.

Source/_javascript_Core:

Add back the overload; the changes to WebCore should hopefully keep Windows building.

* wtf/MainThread.cpp:
(WTF::callFunctionObject):
(WTF::callOnMainThread):
* wtf/MainThread.h:

Source/WebCore:

Explicitly qualify the Function enum flag, since MSVC2005 is too stupid to disambiguate
the Function class template and the enum flag.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertyDescriptor):
* bindings/js/JSHistoryCustom.cpp:
(WebCore::JSHistory::getOwnPropertySlotDelegate):
(WebCore::JSHistory::getOwnPropertyDescriptorDelegate):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::getOwnPropertySlotDelegate):
(WebCore::JSLocation::getOwnPropertyDescriptorDelegate):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (102796 => 102797)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-14 18:36:45 UTC (rev 102797)
@@ -1,3 +1,17 @@
+2011-12-14  Anders Carlsson  <[email protected]>
+
+        Add back the callOnMainThread overload that takes a WTF::Function
+        https://bugs.webkit.org/show_bug.cgi?id=74512
+
+        Reviewed by Darin Adler.
+
+        Add back the overload; the changes to WebCore should hopefully keep Windows building.
+
+        * wtf/MainThread.cpp:
+        (WTF::callFunctionObject):
+        (WTF::callOnMainThread):
+        * wtf/MainThread.h:
+
 2011-12-13  Filip Pizlo  <[email protected]>
 
         DFG should infer when local variables are doubles

Modified: trunk/Source/_javascript_Core/wtf/MainThread.cpp (102796 => 102797)


--- trunk/Source/_javascript_Core/wtf/MainThread.cpp	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/_javascript_Core/wtf/MainThread.cpp	2011-12-14 18:36:45 UTC (rev 102797)
@@ -217,6 +217,18 @@
     }
 }
 
+static void callFunctionObject(void* context)
+{
+    Function<void ()>* function = static_cast<Function<void ()>*>(context);
+    (*function)();
+    delete function;
+}
+
+void callOnMainThread(const Function<void ()>& function)
+{
+    callOnMainThread(callFunctionObject, new Function<void ()>(function));
+}
+
 void setMainThreadCallbacksPaused(bool paused)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/_javascript_Core/wtf/MainThread.h (102796 => 102797)


--- trunk/Source/_javascript_Core/wtf/MainThread.h	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/_javascript_Core/wtf/MainThread.h	2011-12-14 18:36:45 UTC (rev 102797)
@@ -46,6 +46,9 @@
 void callOnMainThreadAndWait(MainThreadFunction*, void* context);
 void cancelCallOnMainThread(MainThreadFunction*, void* context);
 
+template<typename> class Function;
+void callOnMainThread(const Function<void ()>&);
+    
 void setMainThreadCallbacksPaused(bool paused);
 
 bool isMainThread();

Modified: trunk/Source/WebCore/ChangeLog (102796 => 102797)


--- trunk/Source/WebCore/ChangeLog	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/WebCore/ChangeLog	2011-12-14 18:36:45 UTC (rev 102797)
@@ -1,3 +1,23 @@
+2011-12-14  Anders Carlsson  <[email protected]>
+
+        Add back the callOnMainThread overload that takes a WTF::Function
+        https://bugs.webkit.org/show_bug.cgi?id=74512
+
+        Reviewed by Darin Adler.
+
+        Explicitly qualify the Function enum flag, since MSVC2005 is too stupid to disambiguate
+        the Function class template and the enum flag.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::getOwnPropertySlot):
+        (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::getOwnPropertySlotDelegate):
+        (WebCore::JSHistory::getOwnPropertyDescriptorDelegate):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::JSLocation::getOwnPropertySlotDelegate):
+        (WebCore::JSLocation::getOwnPropertyDescriptorDelegate):
+
 2011-12-14  Kenneth Russell  <[email protected]>
 
         Unreviewed, rolling out r102688.

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (102796 => 102797)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2011-12-14 18:36:45 UTC (rev 102797)
@@ -137,12 +137,12 @@
         // The following code is safe for cross-domain and same domain use.
         // It ignores any custom properties that might be set on the DOMWindow (including a custom prototype).
         entry = s_info.propHashTable(exec)->entry(exec, propertyName);
-        if (entry && !(entry->attributes() & Function) && entry->propertyGetter() == jsDOMWindowClosed) {
+        if (entry && !(entry->attributes() & JSC::Function) && entry->propertyGetter() == jsDOMWindowClosed) {
             slot.setCustom(thisObject, entry->propertyGetter());
             return true;
         }
         entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
-        if (entry && (entry->attributes() & Function) && entry->function() == jsDOMWindowPrototypeFunctionClose) {
+        if (entry && (entry->attributes() & JSC::Function) && entry->function() == jsDOMWindowPrototypeFunctionClose) {
             slot.setCustom(thisObject, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionClose, 0>);
             return true;
         }
@@ -170,7 +170,7 @@
     // what prototype is actually set on this object.
     entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (entry) {
-        if (entry->attributes() & Function) {
+        if (entry->attributes() & JSC::Function) {
             if (entry->function() == jsDOMWindowPrototypeFunctionBlur) {
                 if (!allowsAccess) {
                     slot.setCustom(thisObject, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionBlur, 0>);
@@ -281,12 +281,12 @@
         // The following code is safe for cross-domain and same domain use.
         // It ignores any custom properties that might be set on the DOMWindow (including a custom prototype).
         entry = s_info.propHashTable(exec)->entry(exec, propertyName);
-        if (entry && !(entry->attributes() & Function) && entry->propertyGetter() == jsDOMWindowClosed) {
+        if (entry && !(entry->attributes() & JSC::Function) && entry->propertyGetter() == jsDOMWindowClosed) {
             descriptor.setDescriptor(jsBoolean(true), ReadOnly | DontDelete | DontEnum);
             return true;
         }
         entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
-        if (entry && (entry->attributes() & Function) && entry->function() == jsDOMWindowPrototypeFunctionClose) {
+        if (entry && (entry->attributes() & JSC::Function) && entry->function() == jsDOMWindowPrototypeFunctionClose) {
             PropertySlot slot;
             slot.setCustom(thisObject, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionClose, 0>);
             descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);

Modified: trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp (102796 => 102797)


--- trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2011-12-14 18:36:45 UTC (rev 102797)
@@ -68,7 +68,7 @@
     const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (entry) {
         // Allow access to back(), forward() and go() from any frame.
-        if (entry->attributes() & Function) {
+        if (entry->attributes() & JSC::Function) {
             if (entry->function() == jsHistoryPrototypeFunctionBack) {
                 slot.setCustom(this, nonCachingStaticBackFunctionGetter);
                 return true;
@@ -109,7 +109,7 @@
     if (entry) {
         PropertySlot slot;
         // Allow access to back(), forward() and go() from any frame.
-        if (entry->attributes() & Function) {
+        if (entry->attributes() & JSC::Function) {
             if (entry->function() == jsHistoryPrototypeFunctionBack) {
                 slot.setCustom(this, nonCachingStaticBackFunctionGetter);
                 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());

Modified: trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp (102796 => 102797)


--- trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp	2011-12-14 18:30:55 UTC (rev 102796)
+++ trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp	2011-12-14 18:36:45 UTC (rev 102797)
@@ -64,7 +64,7 @@
 
     // Check for the few functions that we allow, even when called cross-domain.
     const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
-    if (entry && (entry->attributes() & Function)) {
+    if (entry && (entry->attributes() & JSC::Function)) {
         if (entry->function() == jsLocationPrototypeFunctionReplace) {
             slot.setCustom(this, nonCachingStaticReplaceFunctionGetter);
             return true;
@@ -101,7 +101,7 @@
     // Check for the few functions that we allow, even when called cross-domain.
     const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     PropertySlot slot;
-    if (entry && (entry->attributes() & Function)) {
+    if (entry && (entry->attributes() & JSC::Function)) {
         if (entry->function() == jsLocationPrototypeFunctionReplace) {
             slot.setCustom(this, nonCachingStaticReplaceFunctionGetter);
             descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to