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

Side by Side Diff: components/scheduler/renderer/throttling_helper.cc

Issue 1743813002: Revert of [cherrypick] Fix computation of runtime for throttled tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/scheduler/renderer/throttling_helper.h" 5 #include "components/scheduler/renderer/throttling_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/scheduler/base/real_time_domain.h" 8 #include "components/scheduler/base/real_time_domain.h"
9 #include "components/scheduler/base/virtual_time_domain.h"
9 #include "components/scheduler/child/scheduler_tqm_delegate.h" 10 #include "components/scheduler/child/scheduler_tqm_delegate.h"
10 #include "components/scheduler/renderer/renderer_scheduler_impl.h" 11 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
11 #include "components/scheduler/renderer/throttled_time_domain.h"
12 #include "components/scheduler/renderer/web_frame_scheduler_impl.h" 12 #include "components/scheduler/renderer/web_frame_scheduler_impl.h"
13 #include "third_party/WebKit/public/platform/WebFrameScheduler.h" 13 #include "third_party/WebKit/public/platform/WebFrameScheduler.h"
14 14
15 namespace scheduler { 15 namespace scheduler {
16 16
17 ThrottlingHelper::ThrottlingHelper(RendererSchedulerImpl* renderer_scheduler, 17 ThrottlingHelper::ThrottlingHelper(RendererSchedulerImpl* renderer_scheduler,
18 const char* tracing_category) 18 const char* tracing_category)
19 : task_runner_(renderer_scheduler->ControlTaskRunner()), 19 : task_runner_(renderer_scheduler->ControlTaskRunner()),
20 renderer_scheduler_(renderer_scheduler), 20 renderer_scheduler_(renderer_scheduler),
21 tick_clock_(renderer_scheduler->tick_clock()), 21 tick_clock_(renderer_scheduler->tick_clock()),
22 tracing_category_(tracing_category), 22 tracing_category_(tracing_category),
23 time_domain_(new ThrottledTimeDomain(this, tick_clock_)), 23 time_domain_(new VirtualTimeDomain(this, tick_clock_->NowTicks())),
24 weak_factory_(this) { 24 weak_factory_(this) {
25 suspend_timers_when_backgrounded_closure_.Reset(base::Bind( 25 suspend_timers_when_backgrounded_closure_.Reset(base::Bind(
26 &ThrottlingHelper::PumpThrottledTasks, weak_factory_.GetWeakPtr())); 26 &ThrottlingHelper::PumpThrottledTasks, weak_factory_.GetWeakPtr()));
27 forward_immediate_work_closure_ = 27 forward_immediate_work_closure_ =
28 base::Bind(&ThrottlingHelper::OnTimeDomainHasImmediateWork, 28 base::Bind(&ThrottlingHelper::OnTimeDomainHasImmediateWork,
29 weak_factory_.GetWeakPtr()); 29 weak_factory_.GetWeakPtr());
30 30
31 renderer_scheduler_->RegisterTimeDomain(time_domain_.get()); 31 renderer_scheduler_->RegisterTimeDomain(time_domain_.get());
32 } 32 }
33 33
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 pending_pump_throttled_tasks_runtime_ = throttled_runtime; 130 pending_pump_throttled_tasks_runtime_ = throttled_runtime;
131 131
132 suspend_timers_when_backgrounded_closure_.Cancel(); 132 suspend_timers_when_backgrounded_closure_.Cancel();
133 task_runner_->PostDelayedTask( 133 task_runner_->PostDelayedTask(
134 from_here, suspend_timers_when_backgrounded_closure_.callback(), 134 from_here, suspend_timers_when_backgrounded_closure_.callback(),
135 pending_pump_throttled_tasks_runtime_ - now); 135 pending_pump_throttled_tasks_runtime_ - now);
136 } 136 }
137 137
138 } // namespace scheduler 138 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/throttling_helper.h ('k') | components/scheduler/renderer/throttling_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698