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

Side by Side Diff: cc/resources/worker_pool.cc

Issue 53923005: Add synthetic delay testing framework (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/worker_pool.h" 5 #include "cc/resources/worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/debug/synthetic_delay.h"
12 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/synchronization/condition_variable.h" 15 #include "base/synchronization/condition_variable.h"
15 #include "base/threading/simple_thread.h" 16 #include "base/threading/simple_thread.h"
16 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
17 #include "cc/base/scoped_ptr_deque.h" 18 #include "cc/base/scoped_ptr_deque.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
21 namespace internal { 22 namespace internal {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 // There may be more work available, so wake up another worker thread. 335 // There may be more work available, so wake up another worker thread.
335 has_ready_to_run_tasks_cv_.Signal(); 336 has_ready_to_run_tasks_cv_.Signal();
336 337
337 // Call WillRun() before releasing |lock_| and running task. 338 // Call WillRun() before releasing |lock_| and running task.
338 task->WillRun(); 339 task->WillRun();
339 340
340 { 341 {
341 base::AutoUnlock unlock(lock_); 342 base::AutoUnlock unlock(lock_);
342 343
344 SYNTHETIC_DELAY_BEGIN("cc.worker_pool_task");
343 task->RunOnWorkerThread(thread_index); 345 task->RunOnWorkerThread(thread_index);
346 SYNTHETIC_DELAY_END("cc.worker_pool_task");
344 } 347 }
345 348
346 // This will mark task as finished running. 349 // This will mark task as finished running.
347 task->DidRun(); 350 task->DidRun();
348 351
349 // Now iterate over all dependents to remove dependency and check 352 // Now iterate over all dependents to remove dependency and check
350 // if they are ready to run. 353 // if they are ready to run.
351 scoped_ptr<internal::GraphNode> node = running_tasks_.take_and_erase( 354 scoped_ptr<internal::GraphNode> node = running_tasks_.take_and_erase(
352 task.get()); 355 task.get());
353 if (node) { 356 if (node) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 void WorkerPool::SetTaskGraph(TaskGraph* graph) { 427 void WorkerPool::SetTaskGraph(TaskGraph* graph) {
425 TRACE_EVENT1("cc", "WorkerPool::SetTaskGraph", 428 TRACE_EVENT1("cc", "WorkerPool::SetTaskGraph",
426 "num_tasks", graph->size()); 429 "num_tasks", graph->size());
427 430
428 DCHECK(!in_dispatch_completion_callbacks_); 431 DCHECK(!in_dispatch_completion_callbacks_);
429 432
430 inner_->SetTaskGraph(graph); 433 inner_->SetTaskGraph(graph);
431 } 434 }
432 435
433 } // namespace cc 436 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698