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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/time_domain.cc

Issue 2320403003: Prevent redundant DoWorks due to canceled delayed tasks (Closed)
Patch Set: Changes for Sami Created 4 years, 3 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 | « third_party/WebKit/Source/platform/scheduler/base/time_domain.h ('k') | no next file » | 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 "platform/scheduler/base/time_domain.h" 5 #include "platform/scheduler/base/time_domain.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "platform/scheduler/base/task_queue_impl.h" 9 #include "platform/scheduler/base/task_queue_impl.h"
10 #include "platform/scheduler/base/task_queue_manager_delegate.h" 10 #include "platform/scheduler/base/task_queue_manager_delegate.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 DelayedWakeupMultimap::iterator next_wakeup = 191 DelayedWakeupMultimap::iterator next_wakeup =
192 delayed_wakeup_multimap_.begin(); 192 delayed_wakeup_multimap_.begin();
193 if (next_wakeup->first > lazy_now->Now()) 193 if (next_wakeup->first > lazy_now->Now())
194 break; 194 break;
195 // A queue could have any number of delayed tasks pending so it's worthwhile 195 // A queue could have any number of delayed tasks pending so it's worthwhile
196 // deduping calls to UpdateDelayedWorkQueue since it takes a lock. 196 // deduping calls to UpdateDelayedWorkQueue since it takes a lock.
197 // NOTE the order in which these are called matters since the order 197 // NOTE the order in which these are called matters since the order
198 // in which EnqueueTaskLocks is called is respected when choosing which 198 // in which EnqueueTaskLocks is called is respected when choosing which
199 // queue to execute a task from. 199 // queue to execute a task from.
200 if (dedup_set.insert(next_wakeup->second).second) { 200 if (dedup_set.insert(next_wakeup->second).second) {
201 next_wakeup->second->MoveReadyDelayedTasksToDelayedWorkQueue(lazy_now); 201 next_wakeup->second->WakeUpForDelayedWork(lazy_now);
202 } 202 }
203 delayed_wakeup_multimap_.erase(next_wakeup); 203 delayed_wakeup_multimap_.erase(next_wakeup);
204 } 204 }
205 } 205 }
206 206
207 void TimeDomain::ClearExpiredWakeups() { 207 void TimeDomain::ClearExpiredWakeups() {
208 DCHECK(main_thread_checker_.CalledOnValidThread()); 208 DCHECK(main_thread_checker_.CalledOnValidThread());
209 LazyNow lazy_now(CreateLazyNow()); 209 LazyNow lazy_now(CreateLazyNow());
210 while (!delayed_wakeup_multimap_.empty()) { 210 while (!delayed_wakeup_multimap_.empty()) {
211 DelayedWakeupMultimap::iterator next_wakeup = 211 DelayedWakeupMultimap::iterator next_wakeup =
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (!delayed_wakeup_multimap_.empty()) { 245 if (!delayed_wakeup_multimap_.empty()) {
246 base::TimeDelta delay = delayed_wakeup_multimap_.begin()->first - Now(); 246 base::TimeDelta delay = delayed_wakeup_multimap_.begin()->first - Now();
247 state->SetDouble("next_delay_ms", delay.InMillisecondsF()); 247 state->SetDouble("next_delay_ms", delay.InMillisecondsF());
248 } 248 }
249 AsValueIntoInternal(state); 249 AsValueIntoInternal(state);
250 state->EndDictionary(); 250 state->EndDictionary();
251 } 251 }
252 252
253 } // namespace scheduler 253 } // namespace scheduler
254 } // namespace blink 254 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scheduler/base/time_domain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698