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

Unified Diff: gin/public/isolate_holder.h

Issue 577733002: Mojo JS bindings: draining a DataPipe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More size_t Created 6 years, 3 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 | « gin/isolate_holder.cc ('k') | gin/run_microtasks_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/public/isolate_holder.h
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index da65facff63d6fe5d20b5c4c43fc9f7239bb08b6..29cc2083334b356d9caff02a5b75abc9bc562b49 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -13,6 +13,7 @@
namespace gin {
class PerIsolateData;
+class RunMicrotasksObserver;
// To embed Gin, first initialize gin using IsolateHolder::Initialize and then
// create an instance of IsolateHolder to hold the v8::Isolate in which you
@@ -36,9 +37,22 @@ class GIN_EXPORT IsolateHolder {
v8::Isolate* isolate() { return isolate_; }
+ // The implementations of Object.observe() and Promise enqueue v8 Microtasks
+ // that should be executed just before control is returned to the message
+ // loop. This method adds a MessageLoop TaskObserver which runs any pending
+ // Microtasks each time a Task is completed. This method should be called
+ // once, when a MessageLoop is created and it should be called on the
+ // MessageLoop's thread.
+ void AddRunMicrotasksObserver();
+
+ // This method should also only be called once, and on the MessageLoop's
+ // thread.
+ void RemoveRunMicrotasksObserver();
+
private:
v8::Isolate* isolate_;
scoped_ptr<PerIsolateData> isolate_data_;
+ scoped_ptr<RunMicrotasksObserver> task_observer_;
DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
};
« no previous file with comments | « gin/isolate_holder.cc ('k') | gin/run_microtasks_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698