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

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

Issue 17351017: Re-land: cc: Add raster finished signals to RasterWorkerPool. (Closed) Base URL: http://git.chromium.org/chromium/src.git@new-graph-build
Patch Set: fix flaky unit tests Created 7 years, 5 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 | « cc/resources/pixel_buffer_raster_worker_pool.cc ('k') | cc/resources/raster_worker_pool.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 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_RASTER_WORKER_POOL_H_ 5 #ifndef CC_RESOURCES_RASTER_WORKER_POOL_H_
6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_ 6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool is_tile_in_pending_tree_now_bin; 98 bool is_tile_in_pending_tree_now_bin;
99 TileResolution tile_resolution; 99 TileResolution tile_resolution;
100 int layer_id; 100 int layer_id;
101 const void* tile_id; 101 const void* tile_id;
102 int source_frame_number; 102 int source_frame_number;
103 }; 103 };
104 104
105 class CC_EXPORT RasterWorkerPoolClient { 105 class CC_EXPORT RasterWorkerPoolClient {
106 public: 106 public:
107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; 107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0;
108 virtual void DidFinishedRunningTasks() = 0;
109 virtual void DidFinishedRunningTasksRequiredForActivation() = 0;
108 110
109 protected: 111 protected:
110 virtual ~RasterWorkerPoolClient() {} 112 virtual ~RasterWorkerPoolClient() {}
111 }; 113 };
112 114
113 // A worker thread pool that runs raster tasks. 115 // A worker thread pool that runs raster tasks.
114 class CC_EXPORT RasterWorkerPool : public WorkerPool { 116 class CC_EXPORT RasterWorkerPool : public WorkerPool {
115 public: 117 public:
116 class CC_EXPORT Task { 118 class CC_EXPORT Task {
117 public: 119 public:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const Task::Reply& reply); 225 const Task::Reply& reply);
224 226
225 protected: 227 protected:
226 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; 228 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector;
227 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > 229 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> >
228 RasterTaskVector; 230 RasterTaskVector;
229 typedef internal::RasterWorkerPoolTask* TaskMapKey; 231 typedef internal::RasterWorkerPoolTask* TaskMapKey;
230 typedef base::hash_map<TaskMapKey, 232 typedef base::hash_map<TaskMapKey,
231 scoped_refptr<internal::WorkerPoolTask> > TaskMap; 233 scoped_refptr<internal::WorkerPoolTask> > TaskMap;
232 234
233 class CC_EXPORT RasterTaskGraph {
234 public:
235 RasterTaskGraph();
236 ~RasterTaskGraph();
237
238 void InsertRasterTask(internal::WorkerPoolTask* raster_task,
239 const TaskVector& decode_tasks);
240
241 private:
242 friend class RasterWorkerPool;
243
244 TaskGraph graph_;
245 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
246 scoped_ptr<GraphNode> raster_finished_node_;
247 unsigned next_priority_;
248
249 DISALLOW_COPY_AND_ASSIGN(RasterTaskGraph);
250 };
251
252 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads); 235 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads);
253 236
254 virtual void OnRasterTasksFinished() {} 237 virtual void OnRasterTasksFinished() = 0;
238 virtual void OnRasterTasksRequiredForActivationFinished() = 0;
255 239
256 void SetRasterTasks(RasterTask::Queue* queue); 240 void SetRasterTasks(RasterTask::Queue* queue);
257 void SetRasterTaskGraph(RasterTaskGraph* graph);
258 bool IsRasterTaskRequiredForActivation( 241 bool IsRasterTaskRequiredForActivation(
259 internal::RasterWorkerPoolTask* task) const; 242 internal::RasterWorkerPoolTask* task) const;
260 243
261 RasterWorkerPoolClient* client() const { return client_; } 244 RasterWorkerPoolClient* client() const { return client_; }
262 ResourceProvider* resource_provider() const { return resource_provider_; } 245 ResourceProvider* resource_provider() const { return resource_provider_; }
263 const RasterTask::Queue::TaskVector& raster_tasks() const { 246 const RasterTask::Queue::TaskVector& raster_tasks() const {
264 return raster_tasks_; 247 return raster_tasks_;
265 } 248 }
249 void set_raster_finished_task(
250 scoped_refptr<internal::WorkerPoolTask> raster_finished_task) {
251 raster_finished_task_ = raster_finished_task;
252 }
253 void set_raster_required_for_activation_finished_task(
254 scoped_refptr<internal::WorkerPoolTask>
255 raster_required_for_activation_finished_task) {
256 raster_required_for_activation_finished_task_ =
257 raster_required_for_activation_finished_task;
258 }
259
260 scoped_refptr<internal::WorkerPoolTask> CreateRasterFinishedTask();
261 scoped_refptr<internal::WorkerPoolTask>
262 CreateRasterRequiredForActivationFinishedTask();
263
264 scoped_ptr<base::Value> ScheduledStateAsValue() const;
265
266 static internal::GraphNode* CreateGraphNodeForTask(
267 internal::WorkerPoolTask* task,
268 unsigned priority,
269 TaskGraph* graph);
270
271 static internal::GraphNode* CreateGraphNodeForRasterTask(
272 internal::WorkerPoolTask* raster_task,
273 const TaskVector& decode_tasks,
274 unsigned priority,
275 TaskGraph* graph);
266 276
267 private: 277 private:
268 void OnRasterFinished(int64 schedule_raster_tasks_count); 278 void OnRasterFinished(const internal::WorkerPoolTask* source);
279 void OnRasterRequiredForActivationFinished(
280 const internal::WorkerPoolTask* source);
269 281
270 RasterWorkerPoolClient* client_; 282 RasterWorkerPoolClient* client_;
271 ResourceProvider* resource_provider_; 283 ResourceProvider* resource_provider_;
272 RasterTask::Queue::TaskVector raster_tasks_; 284 RasterTask::Queue::TaskVector raster_tasks_;
273 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; 285 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_;
274 286
275 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 287 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
276 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 288 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
277 int64 schedule_raster_tasks_count_; 289 scoped_refptr<internal::WorkerPoolTask>
290 raster_required_for_activation_finished_task_;
278 }; 291 };
279 292
280 } // namespace cc 293 } // namespace cc
281 294
282 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 295 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.cc ('k') | cc/resources/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698