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

Unified Diff: sky/viewer/platform/platform_impl.cc

Issue 886263002: Move SharedTimer implementation into sky/engine (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: style Created 5 years, 11 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 | « sky/viewer/platform/platform_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/platform/platform_impl.cc
diff --git a/sky/viewer/platform/platform_impl.cc b/sky/viewer/platform/platform_impl.cc
index 926bdbd01c678b245f1a6bd2487317b615178e5f..dcfa4ef38ea7d715b9a8fa499328c910a70be965 100644
--- a/sky/viewer/platform/platform_impl.cc
+++ b/sky/viewer/platform/platform_impl.cc
@@ -21,15 +21,8 @@ namespace sky {
PlatformImpl::PlatformImpl(mojo::ApplicationImpl* app)
: main_loop_(base::MessageLoop::current()),
- main_thread_task_runner_(base::MessageLoop::current()->task_runner()),
- shared_timer_func_(NULL),
- shared_timer_fire_time_(0.0),
- shared_timer_fire_time_was_set_while_suspended_(false),
- shared_timer_suspended_(0) {
+ main_thread_task_runner_(base::MessageLoop::current()->task_runner()) {
app->ConnectToService("mojo:network_service", &network_service_);
-
- mojo::CookieStorePtr cookie_store;
- network_service_->GetCookieStore(GetProxy(&cookie_store));
}
PlatformImpl::~PlatformImpl() {
@@ -39,47 +32,6 @@ blink::WebString PlatformImpl::defaultLocale() {
return blink::WebString::fromUTF8("en-US");
}
-void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) {
- shared_timer_func_ = func;
-}
-
-void PlatformImpl::setSharedTimerFireInterval(
- double interval_seconds) {
- double now = base::TimeTicks::Now().ToInternalValue() /
- static_cast<double>(base::Time::kMicrosecondsPerSecond);
-
- shared_timer_fire_time_ = interval_seconds + now;
- if (shared_timer_suspended_) {
- shared_timer_fire_time_was_set_while_suspended_ = true;
- return;
- }
-
- // By converting between double and int64 representation, we run the risk
- // of losing precision due to rounding errors. Performing computations in
- // microseconds reduces this risk somewhat. But there still is the potential
- // of us computing a fire time for the timer that is shorter than what we
- // need.
- // As the event loop will check event deadlines prior to actually firing
- // them, there is a risk of needlessly rescheduling events and of
- // needlessly looping if sleep times are too short even by small amounts.
- // This results in measurable performance degradation unless we use ceil() to
- // always round up the sleep times.
- 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, &PlatformImpl::DoTimeout);
-}
-
-void PlatformImpl::stopSharedTimer() {
- shared_timer_.Stop();
-}
-
base::SingleThreadTaskRunner* PlatformImpl::mainThreadTaskRunner() {
return main_thread_task_runner_.get();
}
« no previous file with comments | « sky/viewer/platform/platform_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698