Title: [166943] trunk/Source/WebCore
Revision
166943
Author
mark....@apple.com
Date
2014-04-08 12:12:37 -0700 (Tue, 08 Apr 2014)

Log Message

Refactor to make JSMainThreadExecState's constructor and destructor private.
<https://webkit.org/b/131372>

Reviewed by Mark Hahnenberg.

This is in preparation for subsequent patches to ensure that we don't
exit the VM with an exception still pending.

No new tests required.  This is only a refactor of existing behavior.

* bindings/js/JSDOMGlobalObjectTask.cpp:
* bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadExecState::runTask):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166942 => 166943)


--- trunk/Source/WebCore/ChangeLog	2014-04-08 19:07:06 UTC (rev 166942)
+++ trunk/Source/WebCore/ChangeLog	2014-04-08 19:12:37 UTC (rev 166943)
@@ -1,3 +1,19 @@
+2014-04-08  Mark Lam  <mark....@apple.com>
+
+        Refactor to make JSMainThreadExecState's constructor and destructor private.
+        <https://webkit.org/b/131372>
+
+        Reviewed by Mark Hahnenberg.
+
+        This is in preparation for subsequent patches to ensure that we don't
+        exit the VM with an exception still pending.
+
+        No new tests required.  This is only a refactor of existing behavior.
+
+        * bindings/js/JSDOMGlobalObjectTask.cpp:
+        * bindings/js/JSMainThreadExecState.h:
+        (WebCore::JSMainThreadExecState::runTask):
+
 2014-04-07  Jer Noble  <jer.no...@apple.com>
 
         [WK2][iOS] Consecutive videos in full screen display only black

Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp (166942 => 166943)


--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp	2014-04-08 19:07:06 UTC (rev 166942)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp	2014-04-08 19:12:37 UTC (rev 166943)
@@ -60,11 +60,10 @@
 
         // When on the main thread (e.g. the document's thread), we need to make sure to
         // push the current ExecState on to the JSMainThreadExecState stack.
-        if (context->isDocument()) {
-            JSMainThreadExecState currentState(exec);
+        if (context->isDocument())
+            JSMainThreadExecState::runTask(exec, *m_task.get());
+        else
             m_task->run(exec);
-        } else
-            m_task->run(exec);
     }
 
 private:

Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h (166942 => 166943)


--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h	2014-04-08 19:07:06 UTC (rev 166942)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h	2014-04-08 19:12:37 UTC (rev 166943)
@@ -28,6 +28,7 @@
 
 #include "JSDOMBinding.h"
 #include <runtime/Completion.h>
+#include <runtime/Microtask.h>
 #include <wtf/MainThread.h>
 
 #if PLATFORM(IOS)
@@ -62,8 +63,15 @@
         return JSC::evaluate(exec, source, thisValue, exception);
     };
 
+    static void runTask(JSC::ExecState* exec, JSC::Microtask& task)
+    {
+        JSMainThreadExecState currentState(exec);
+        task.run(exec);
+    }
+
     static InspectorInstrumentationCookie instrumentFunctionCall(ScriptExecutionContext*, JSC::CallType, const JSC::CallData&);
 
+private:
     explicit JSMainThreadExecState(JSC::ExecState* exec)
         : m_previousState(s_mainThreadState)
     {
@@ -83,7 +91,6 @@
             didLeaveScriptContext();
     }
 
-private:
     static JSC::ExecState* s_mainThreadState;
     JSC::ExecState* m_previousState;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to