Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: Source/core/dom/Microtask.cpp

Issue 242123005: Allow posting a Task to Microtasks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: changes made Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Microtask.h ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Microtask.cpp
diff --git a/Source/core/dom/Microtask.cpp b/Source/core/dom/Microtask.cpp
index e63b84b1f60d1b998e79bd7c14b378e2510dbad4..8902693cd08bb3918bec1fba6f98ebf557690b36 100644
--- a/Source/core/dom/Microtask.cpp
+++ b/Source/core/dom/Microtask.cpp
@@ -32,12 +32,14 @@
#include "core/dom/Microtask.h"
#include "bindings/v8/V8PerIsolateData.h"
+#include "platform/Task.h"
+#include "public/platform/WebThread.h"
#include "wtf/Vector.h"
#include <v8.h>
namespace WebCore {
-typedef Vector<MicrotaskCallback> MicrotaskQueue;
+typedef Vector<OwnPtr<blink::WebThread::Task> > MicrotaskQueue;
static MicrotaskQueue& microtaskQueue()
{
@@ -54,19 +56,23 @@ void Microtask::performCheckpoint()
isolateData->setPerformingMicrotaskCheckpoint(true);
while (!microtaskQueue().isEmpty()) {
- Vector<MicrotaskCallback> microtasks;
+ MicrotaskQueue microtasks;
microtasks.swap(microtaskQueue());
for (size_t i = 0; i < microtasks.size(); ++i) {
- microtasks[i]();
+ microtasks[i]->run();
}
}
isolateData->setPerformingMicrotaskCheckpoint(false);
}
-void Microtask::enqueueMicrotask(MicrotaskCallback callback)
+void Microtask::enqueueMicrotask(PassOwnPtr<blink::WebThread::Task> callback)
{
microtaskQueue().append(callback);
}
+void Microtask::enqueueMicrotask(const Closure& callback)
+{
+ enqueueMicrotask(adoptPtr(new Task(callback)));
+}
} // namespace WebCore
« no previous file with comments | « Source/core/dom/Microtask.h ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698