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

Unified Diff: gin/run_microtasks_observer.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/public/isolate_holder.h ('k') | gin/run_microtasks_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/run_microtasks_observer.h
diff --git a/gin/run_microtasks_observer.h b/gin/run_microtasks_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e848239ef2f62aaf6db5a9b452e0aac64c8793f0
--- /dev/null
+++ b/gin/run_microtasks_observer.h
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GIN_RUN_MICROTASKS_OBSERVER_H_
+#define GIN_RUN_MICROTASKS_OBSERVER_H_
+
+#include "base/message_loop/message_loop.h"
+#include "v8/include/v8.h"
+
+namespace gin {
+
+// Runs any pending v8 Microtasks each time a task is completed.
+// TODO(hansmuller); At some point perhaps this can be replaced with
+// the (currently experimental) Isolate::SetAutorunMicrotasks() method.
+
+class RunMicrotasksObserver : public base::MessageLoop::TaskObserver {
+ public:
+ RunMicrotasksObserver(v8::Isolate* isolate);
+
+ virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE;
+ virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE;
+
+ private:
+ v8::Isolate* isolate_;
+};
+
+} // namespace gin
+
+#endif // GIN_RUN_MICROTASKS_OBSERVER_H_
« no previous file with comments | « gin/public/isolate_holder.h ('k') | gin/run_microtasks_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698