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

Side by Side Diff: components/scheduler/child/task_queue_manager.cc

Issue 1287003003: [scheduler]: Fix a bug with non-nestable tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | components/scheduler/child/task_queue_manager_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/task_queue_manager.h" 5 #include "components/scheduler/child/task_queue_manager.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 // Detect if the TaskQueueManager just got deleted. If this happens we must 295 // Detect if the TaskQueueManager just got deleted. If this happens we must
296 // not access any member variables after this point. 296 // not access any member variables after this point.
297 if (protect->HasOneRef()) 297 if (protect->HasOneRef())
298 return true; 298 return true;
299 299
300 if (queue->GetShouldNotifyObservers()) { 300 if (queue->GetShouldNotifyObservers()) {
301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, 301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_,
302 DidProcessTask(pending_task)); 302 DidProcessTask(pending_task));
303 } 303 }
304 }
304 305
305 pending_task.task.Reset(); 306 pending_task.task.Reset();
306 *out_previous_task = pending_task; 307 *out_previous_task = pending_task;
Sami 2015/08/12 11:47:51 Hmm, should we just ignore out_previous_task if we
rmcilroy 2015/08/12 13:08:27 As discussed offline, this might be our only chanc
307 }
308 return false; 308 return false;
309 } 309 }
310 310
311 bool TaskQueueManager::RunsTasksOnCurrentThread() const { 311 bool TaskQueueManager::RunsTasksOnCurrentThread() const {
312 return main_task_runner_->RunsTasksOnCurrentThread(); 312 return main_task_runner_->RunsTasksOnCurrentThread();
313 } 313 }
314 314
315 bool TaskQueueManager::PostDelayedTask( 315 bool TaskQueueManager::PostDelayedTask(
316 const tracked_objects::Location& from_here, 316 const tracked_objects::Location& from_here,
317 const base::Closure& task, 317 const base::Closure& task,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { 385 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) {
386 DCHECK(main_thread_checker_.CalledOnValidThread()); 386 DCHECK(main_thread_checker_.CalledOnValidThread());
387 // Only schedule DoWork if there's something to do. 387 // Only schedule DoWork if there's something to do.
388 if (!queue->work_queue().empty()) 388 if (!queue->work_queue().empty())
389 MaybePostDoWorkOnMainRunner(); 389 MaybePostDoWorkOnMainRunner();
390 } 390 }
391 391
392 } // namespace scheduler 392 } // namespace scheduler
OLDNEW
« no previous file with comments | « no previous file | components/scheduler/child/task_queue_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698