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

Side by Side Diff: components/scheduler/base/task_queue_impl.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
« no previous file with comments | « components/scheduler/base/real_time_domain.cc ('k') | components/scheduler/base/time_domain.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/task_queue_impl.h" 5 #include "components/scheduler/base/task_queue_impl.h"
6 6
7 #include "components/scheduler/base/task_queue_manager.h" 7 #include "components/scheduler/base/task_queue_manager.h"
8 #include "components/scheduler/base/task_queue_manager_delegate.h" 8 #include "components/scheduler/base/task_queue_manager_delegate.h"
9 #include "components/scheduler/base/time_domain.h" 9 #include "components/scheduler/base/time_domain.h"
10 #include "components/scheduler/base/work_queue.h" 10 #include "components/scheduler/base/work_queue.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool TaskQueueImpl::PostDelayedTaskImpl( 142 bool TaskQueueImpl::PostDelayedTaskImpl(
143 const tracked_objects::Location& from_here, 143 const tracked_objects::Location& from_here,
144 const base::Closure& task, 144 const base::Closure& task,
145 base::TimeDelta delay, 145 base::TimeDelta delay,
146 TaskType task_type) { 146 TaskType task_type) {
147 base::AutoLock lock(any_thread_lock_); 147 base::AutoLock lock(any_thread_lock_);
148 if (!any_thread().task_queue_manager) 148 if (!any_thread().task_queue_manager)
149 return false; 149 return false;
150 LazyNow lazy_now(any_thread().time_domain->CreateLazyNow()); 150 LazyNow lazy_now(any_thread().time_domain->CreateLazyNow());
151 base::TimeTicks desired_run_time; 151 base::TimeTicks desired_run_time;
152 if (delay > base::TimeDelta()) 152 if (delay > base::TimeDelta()) {
153 desired_run_time = lazy_now.Now() + delay; 153 base::TimeTicks time_domain_now = lazy_now.Now();
154 desired_run_time =
155 any_thread().time_domain->ComputeDelayedRunTime(time_domain_now, delay);
156 }
154 return PostDelayedTaskLocked(&lazy_now, from_here, task, desired_run_time, 157 return PostDelayedTaskLocked(&lazy_now, from_here, task, desired_run_time,
155 task_type); 158 task_type);
156 } 159 }
157 160
158 bool TaskQueueImpl::PostDelayedTaskLocked( 161 bool TaskQueueImpl::PostDelayedTaskLocked(
159 LazyNow* lazy_now, 162 LazyNow* lazy_now,
160 const tracked_objects::Location& from_here, 163 const tracked_objects::Location& from_here,
161 const base::Closure& task, 164 const base::Closure& task,
162 base::TimeTicks desired_run_time, 165 base::TimeTicks desired_run_time,
163 TaskType task_type) { 166 TaskType task_type) {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 state->SetBoolean("nestable", task.nestable); 582 state->SetBoolean("nestable", task.nestable);
580 state->SetBoolean("is_high_res", task.is_high_res); 583 state->SetBoolean("is_high_res", task.is_high_res);
581 state->SetDouble( 584 state->SetDouble(
582 "delayed_run_time", 585 "delayed_run_time",
583 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); 586 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L);
584 state->EndDictionary(); 587 state->EndDictionary();
585 } 588 }
586 589
587 } // namespace internal 590 } // namespace internal
588 } // namespace scheduler 591 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/base/real_time_domain.cc ('k') | components/scheduler/base/time_domain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698