Chromium Code Reviews| Index: content/child/webthread_impl.h |
| diff --git a/content/child/webthread_impl.h b/content/child/webthread_impl.h |
| index 4c81b2579d6806fc2f2d601682ed2446a095a056..d0dce7d02062d676e2ccadc34abc4d6ba560bbe8 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) {} |
|
jochen (gone - plz use gerrit)
2014/07/17 09:48:03
why not = 0?
nasko
2014/07/17 10:49:32
If I make them pure virtual, then I have to provid
|
| + virtual void setSharedTimerFireInterval(double) {} |
| + virtual void stopSharedTimer() {} |
| + |
| protected: |
| WebThreadBase(); |
| @@ -48,7 +54,18 @@ class CONTENT_EXPORT WebThreadImpl : public WebThreadBase { |
| virtual bool isCurrentThread() const OVERRIDE; |
| + virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction); |
| + virtual void setSharedTimerFireInterval(double interval_seconds); |
| + virtual void stopSharedTimer(); |
| + |
| private: |
| + void OnTimeout() { |
| + if (shared_timer_function_) |
| + shared_timer_function_(); |
| + } |
| + base::OneShotTimer<WebThreadImpl> shared_timer_; |
| + SharedTimerFunction shared_timer_function_; |
| + |
| scoped_ptr<base::Thread> thread_; |
| }; |