Index: content/child/webthread_impl.cc |
diff --git a/content/child/webthread_impl.cc b/content/child/webthread_impl.cc |
index d53d06e061036ba3a2c8fb99c5bcee800471eb24..ede0f8ffc6aeb7834c32bf4276baef7f336c0f60 100644 |
--- a/content/child/webthread_impl.cc |
+++ b/content/child/webthread_impl.cc |
@@ -5,6 +5,8 @@ |
// An implementation of WebThread in terms of base::MessageLoop and |
// base::Thread |
+#include <math.h> |
+ |
#include "content/child/webthread_impl.h" |
#include "base/bind.h" |
@@ -88,6 +90,30 @@ bool WebThreadImpl::isCurrentThread() const { |
return thread_->thread_id() == base::PlatformThread::CurrentId(); |
} |
+void WebThreadImpl::setSharedTimerFiredFunction( |
+ SharedTimerFunction timerFunction) { |
+ shared_timer_function_ = timerFunction; |
+} |
+ |
+void WebThreadImpl::setSharedTimerFireInterval(double interval_seconds) { |
+ // See BlinkPlatformImpl::setSharedTimerFireInterval for explanation of |
+ // why ceil is used in the interval calculation. |
+ int64 interval = static_cast<int64>( |
+ ceil(interval_seconds * base::Time::kMillisecondsPerSecond) |
+ * base::Time::kMicrosecondsPerMillisecond); |
+ |
+ if (interval < 0) |
+ interval = 0; |
+ |
+ shared_timer_.Stop(); |
+ shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), |
+ this, &WebThreadImpl::OnTimeout); |
+} |
+ |
+void WebThreadImpl::stopSharedTimer() { |
+ shared_timer_.Stop(); |
+} |
+ |
WebThreadImpl::~WebThreadImpl() { |
thread_->Stop(); |
} |