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

Unified Diff: content/child/webthread_impl.h

Issue 393283003: Add WorkerThread based methods for start/stop of worker threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add math.h to make gn build happy. Created 6 years, 5 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 | « content/child/blink_platform_impl.cc ('k') | content/child/webthread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webthread_impl.h
diff --git a/content/child/webthread_impl.h b/content/child/webthread_impl.h
index 4c81b2579d6806fc2f2d601682ed2446a095a056..476445284c8938972c4e1fc0558262737a8abb1f 100644
--- a/content/child/webthread_impl.h
+++ b/content/child/webthread_impl.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread.h"
+#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebThread.h"
@@ -23,6 +24,11 @@ class CONTENT_EXPORT WebThreadBase : public blink::WebThread {
virtual bool isCurrentThread() const = 0;
+ typedef void (*SharedTimerFunction)();
+ virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) {}
+ virtual void setSharedTimerFireInterval(double) {}
+ virtual void stopSharedTimer() {}
+
protected:
WebThreadBase();
@@ -48,7 +54,19 @@ class CONTENT_EXPORT WebThreadImpl : public WebThreadBase {
virtual bool isCurrentThread() const OVERRIDE;
+ virtual void setSharedTimerFiredFunction(
+ SharedTimerFunction timerFunction) OVERRIDE;
+ virtual void setSharedTimerFireInterval(double interval_seconds) OVERRIDE;
+ virtual void stopSharedTimer() OVERRIDE;
+
private:
+ void OnTimeout() {
+ if (shared_timer_function_)
+ shared_timer_function_();
+ }
+ base::OneShotTimer<WebThreadImpl> shared_timer_;
+ SharedTimerFunction shared_timer_function_;
+
scoped_ptr<base::Thread> thread_;
};
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | content/child/webthread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698