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

Side by Side Diff: components/scheduler/base/virtual_time_domain.cc

Issue 1751953002: [Cherrypick try #2] Fix computation of runtime for throttled tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Fix formatting 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/base/virtual_time_domain.h" 5 #include "components/scheduler/base/virtual_time_domain.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/scheduler/base/task_queue_impl.h" 8 #include "components/scheduler/base/task_queue_impl.h"
9 #include "components/scheduler/base/task_queue_manager.h" 9 #include "components/scheduler/base/task_queue_manager.h"
10 #include "components/scheduler/base/task_queue_manager_delegate.h" 10 #include "components/scheduler/base/task_queue_manager_delegate.h"
(...skipping 10 matching lines...) Expand all
21 TaskQueueManager* task_queue_manager) { 21 TaskQueueManager* task_queue_manager) {
22 task_queue_manager_ = task_queue_manager; 22 task_queue_manager_ = task_queue_manager;
23 DCHECK(task_queue_manager_); 23 DCHECK(task_queue_manager_);
24 } 24 }
25 25
26 LazyNow VirtualTimeDomain::CreateLazyNow() { 26 LazyNow VirtualTimeDomain::CreateLazyNow() {
27 base::AutoLock lock(lock_); 27 base::AutoLock lock(lock_);
28 return LazyNow(now_); 28 return LazyNow(now_);
29 } 29 }
30 30
31 base::TimeTicks VirtualTimeDomain::ComputeDelayedRunTime(
32 base::TimeTicks time_domain_now,
33 base::TimeDelta delay) const {
34 return time_domain_now + delay;
35 }
36
31 void VirtualTimeDomain::RequestWakeup(LazyNow* lazy_now, 37 void VirtualTimeDomain::RequestWakeup(LazyNow* lazy_now,
32 base::TimeDelta delay) { 38 base::TimeDelta delay) {
33 // We don't need to do anything here because the caller of AdvanceTo is 39 // We don't need to do anything here because the caller of AdvanceTo is
34 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if 40 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if
35 // needed. 41 // needed.
36 } 42 }
37 43
38 bool VirtualTimeDomain::MaybeAdvanceTime() { 44 bool VirtualTimeDomain::MaybeAdvanceTime() {
39 return false; 45 return false;
40 } 46 }
41 47
42 void VirtualTimeDomain::AsValueIntoInternal( 48 void VirtualTimeDomain::AsValueIntoInternal(
43 base::trace_event::TracedValue* state) const {} 49 base::trace_event::TracedValue* state) const {}
44 50
45 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { 51 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) {
46 base::AutoLock lock(lock_); 52 base::AutoLock lock(lock_);
47 DCHECK_GE(now, now_); 53 DCHECK_GE(now, now_);
48 now_ = now; 54 now_ = now;
49 } 55 }
50 56
51 void VirtualTimeDomain::RequestDoWork() { 57 void VirtualTimeDomain::RequestDoWork() {
52 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); 58 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE);
53 } 59 }
54 60
55 const char* VirtualTimeDomain::GetName() const { 61 const char* VirtualTimeDomain::GetName() const {
56 return "VirtualTimeDomain"; 62 return "VirtualTimeDomain";
57 } 63 }
58 64
59 } // namespace scheduler 65 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/base/virtual_time_domain.h ('k') | components/scheduler/renderer/throttled_time_domain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698