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

Side by Side Diff: content/renderer/categorized_worker_pool.h

Issue 2047433004: content: Add heartbeat trace for CategorizedWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 6 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
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 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ 5 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
6 #define CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ 6 #define CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void RunTaskInCategoryWithLockAcquired(cc::TaskCategory category); 109 void RunTaskInCategoryWithLockAcquired(cc::TaskCategory category);
110 110
111 // Helper function which signals worker threads if tasks are ready to run. 111 // Helper function which signals worker threads if tasks are ready to run.
112 void SignalHasReadyToRunTasksWithLockAcquired(); 112 void SignalHasReadyToRunTasksWithLockAcquired();
113 113
114 // Determines if we should run a new task for the given category. This factors 114 // Determines if we should run a new task for the given category. This factors
115 // in whether a task is available and whether the count of running tasks is 115 // in whether a task is available and whether the count of running tasks is
116 // low enough to start a new one. 116 // low enough to start a new one.
117 bool ShouldRunTaskForCategoryWithLockAcquired(cc::TaskCategory category); 117 bool ShouldRunTaskForCategoryWithLockAcquired(cc::TaskCategory category);
118 118
119 // Wait for more tasks to run on the given thread.
120 void WaitForMoreTasksWithLockAcquired(
121 base::ConditionVariable* has_ready_to_run_tasks_cv);
122
119 // The actual threads where work is done. 123 // The actual threads where work is done.
120 std::vector<std::unique_ptr<base::SimpleThread>> threads_; 124 std::vector<std::unique_ptr<base::SimpleThread>> threads_;
121 125
122 // Lock to exclusively access all the following members that are used to 126 // Lock to exclusively access all the following members that are used to
123 // implement the TaskRunner and TaskGraphRunner interfaces. 127 // implement the TaskRunner and TaskGraphRunner interfaces.
124 base::Lock lock_; 128 base::Lock lock_;
125 // Stores the tasks to be run, sorted by priority. 129 // Stores the tasks to be run, sorted by priority.
126 cc::TaskGraphWorkQueue work_queue_; 130 cc::TaskGraphWorkQueue work_queue_;
127 // Namespace used to schedule tasks in the task graph runner. 131 // Namespace used to schedule tasks in the task graph runner.
128 cc::NamespaceToken namespace_token_; 132 cc::NamespaceToken namespace_token_;
(...skipping 10 matching lines...) Expand all
139 // Condition variable that is waited on by origin threads until a namespace 143 // Condition variable that is waited on by origin threads until a namespace
140 // has finished running all associated tasks. 144 // has finished running all associated tasks.
141 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; 145 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_;
142 // Set during shutdown. Tells Run() to return when no more tasks are pending. 146 // Set during shutdown. Tells Run() to return when no more tasks are pending.
143 bool shutdown_; 147 bool shutdown_;
144 }; 148 };
145 149
146 } // namespace content 150 } // namespace content
147 151
148 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ 152 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « base/synchronization/condition_variable_win.cc ('k') | content/renderer/categorized_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698