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

Side by Side Diff: cc/raster/synchronous_task_graph_runner.cc

Issue 2687553004: Add context for tasks run by TaskGraphRunner (Closed)
Patch Set: Created 3 years, 10 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 | 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 "cc/raster/synchronous_task_graph_runner.h" 5 #include "cc/raster/synchronous_task_graph_runner.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 DCHECK(token.IsValid()); 60 DCHECK(token.IsValid());
61 work_queue_.CollectCompletedTasks(token, completed_tasks); 61 work_queue_.CollectCompletedTasks(token, completed_tasks);
62 } 62 }
63 63
64 void SynchronousTaskGraphRunner::RunUntilIdle() { 64 void SynchronousTaskGraphRunner::RunUntilIdle() {
65 while (RunTask()) { 65 while (RunTask()) {
66 } 66 }
67 } 67 }
68 68
69 bool SynchronousTaskGraphRunner::RunTask() { 69 bool SynchronousTaskGraphRunner::RunTask() {
70 // Since we do not have posted from location for tasks, record the context for
71 // tasks as "cc" in heap profiler.
72 TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION scoped_event("cc");
70 TRACE_EVENT0("toplevel", "SynchronousTaskGraphRunner::RunTask"); 73 TRACE_EVENT0("toplevel", "SynchronousTaskGraphRunner::RunTask");
71 74
72 // Find the first category with any tasks to run. This task graph runner 75 // Find the first category with any tasks to run. This task graph runner
73 // treats categories as an additional priority. 76 // treats categories as an additional priority.
74 const auto& ready_to_run_namespaces = work_queue_.ready_to_run_namespaces(); 77 const auto& ready_to_run_namespaces = work_queue_.ready_to_run_namespaces();
75 auto found = std::find_if( 78 auto found = std::find_if(
76 ready_to_run_namespaces.cbegin(), ready_to_run_namespaces.cend(), 79 ready_to_run_namespaces.cbegin(), ready_to_run_namespaces.cend(),
77 [](const std::pair<const uint16_t, 80 [](const std::pair<const uint16_t,
78 TaskGraphWorkQueue::TaskNamespace::Vector>& pair) { 81 TaskGraphWorkQueue::TaskNamespace::Vector>& pair) {
79 return !pair.second.empty(); 82 return !pair.second.empty();
80 }); 83 });
81 84
82 if (found == ready_to_run_namespaces.cend()) { 85 if (found == ready_to_run_namespaces.cend()) {
83 return false; 86 return false;
84 } 87 }
85 88
86 const uint16_t category = found->first; 89 const uint16_t category = found->first;
87 auto prioritized_task = work_queue_.GetNextTaskToRun(category); 90 auto prioritized_task = work_queue_.GetNextTaskToRun(category);
88 prioritized_task.task->RunOnWorkerThread(); 91 prioritized_task.task->RunOnWorkerThread();
89 92
90 work_queue_.CompleteTask(std::move(prioritized_task)); 93 work_queue_.CompleteTask(std::move(prioritized_task));
91 94
92 return true; 95 return true;
93 } 96 }
94 97
95 } // namespace cc 98 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698