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

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

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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 #ifndef CC_RESOURCES_WORKER_POOL_H_ 5 #ifndef CC_RESOURCES_WORKER_POOL_H_
6 #define CC_RESOURCES_WORKER_POOL_H_ 6 #define CC_RESOURCES_WORKER_POOL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 public: 101 public:
102 virtual ~WorkerPool(); 102 virtual ~WorkerPool();
103 103
104 // Tells the worker pool to shutdown and returns once all pending tasks have 104 // Tells the worker pool to shutdown and returns once all pending tasks have
105 // completed. 105 // completed.
106 virtual void Shutdown(); 106 virtual void Shutdown();
107 107
108 // Force a check for completed tasks. 108 // Force a check for completed tasks.
109 virtual void CheckForCompletedTasks(); 109 virtual void CheckForCompletedTasks();
110 110
111 // Changed the access specifier to be available for Lazy Instance
112 class Inner;
113 friend class Inner;
reveman 2013/11/15 17:21:41 I don't think it should be a subclass anymore if y
114
111 protected: 115 protected:
112 // A task graph contains a unique set of tasks with edges between 116 // A task graph contains a unique set of tasks with edges between
113 // dependencies pointing in the direction of the dependents. Each task 117 // dependencies pointing in the direction of the dependents. Each task
114 // need to be assigned a unique priority and a run count that matches 118 // need to be assigned a unique priority and a run count that matches
115 // the number of dependencies. 119 // the number of dependencies.
116 typedef base::ScopedPtrHashMap<internal::WorkerPoolTask*, internal::GraphNode> 120 typedef base::ScopedPtrHashMap<internal::WorkerPoolTask*, internal::GraphNode>
117 GraphNodeMap; 121 GraphNodeMap;
118 typedef GraphNodeMap TaskGraph; 122 typedef GraphNodeMap TaskGraph;
119 123
120 WorkerPool(size_t num_threads, const std::string& thread_name_prefix); 124 WorkerPool(size_t num_threads, const std::string& thread_name_prefix);
121 125
122 // Schedule running of tasks in |graph|. Any previously scheduled tasks 126 // Schedule running of tasks in |graph|. Any previously scheduled tasks
123 // that are not already running will be canceled. Canceled tasks don't run 127 // that are not already running will be canceled. Canceled tasks don't run
124 // but completion of them is still processed. 128 // but completion of them is still processed.
125 void SetTaskGraph(TaskGraph* graph); 129 void SetTaskGraph(TaskGraph* graph);
126 130
127 private: 131 private:
128 class Inner;
129 friend class Inner;
130
131 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; 132 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector;
132 133
133 void ProcessCompletedTasks(const TaskVector& completed_tasks); 134 void ProcessCompletedTasks(const TaskVector& completed_tasks);
134 135
135 bool in_dispatch_completion_callbacks_; 136 bool in_dispatch_completion_callbacks_;
136
137 // Hide the gory details of the worker pool in |inner_|.
138 const scoped_ptr<Inner> inner_;
139 }; 137 };
140 138
141 } // namespace cc 139 } // namespace cc
142 140
143 #endif // CC_RESOURCES_WORKER_POOL_H_ 141 #endif // CC_RESOURCES_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | cc/resources/worker_pool.cc » ('j') | cc/resources/worker_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698