Index: third_party/WebKit/Source/bindings/core/v8/Microtask.h |
diff --git a/third_party/WebKit/Source/core/dom/Microtask.h b/third_party/WebKit/Source/bindings/core/v8/Microtask.h |
similarity index 69% |
rename from third_party/WebKit/Source/core/dom/Microtask.h |
rename to third_party/WebKit/Source/bindings/core/v8/Microtask.h |
index 82ac7d1af40a8a1e8a64b926842e98a1d836dd8c..89ecd0f899ceee9cd7ffbbbd9e77cb0c5e1d0dc8 100644 |
--- a/third_party/WebKit/Source/core/dom/Microtask.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.h |
@@ -31,7 +31,6 @@ |
#ifndef Microtask_h |
#define Microtask_h |
-#include "bindings/core/v8/ScriptState.h" |
#include "core/CoreExport.h" |
#include "public/platform/WebTaskRunner.h" |
#include "wtf/Allocator.h" |
@@ -41,6 +40,25 @@ |
namespace blink { |
+// C++ calls into script contexts which are "owned" by blink (created in a |
+// process where WebKit.cpp initializes v8) must declare their type: |
+// |
+// 1. Calls into page/author script from a frame |
+// 2. Calls into page/author script from a worker |
+// 3. Calls into internal script (typically setup/teardown work) |
+// |
+// Debug-time checking of this is enforced via v8::MicrotasksScope. |
+// |
+// Calls of type (1) should generally go through ScriptController, as inspector |
+// instrumentation is needed. ScriptController allocates V8RecursionScope for you. |
+// |
+// Calls of type (2) should always stack-allocate a v8::MicrotasksScope(kRunMicrtoasks) |
+// in the same block as the call into script. |
+// |
+// Calls of type (3) should stack allocate a v8::MicrotasksScope(kDoNotRunMicrotasks) -- |
+// this skips work that is spec'd to happen at the end of the outer-most |
+// script stack frame of calls into page script: |
+// http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint |
class CORE_EXPORT Microtask { |
STATIC_ONLY(Microtask); |
public: |