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

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

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving number of raster thread API to RasterWorkerPool + comments Created 6 years, 11 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 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Once scheduled, reply callbacks are guaranteed to run for all tasks 181 // Once scheduled, reply callbacks are guaranteed to run for all tasks
182 // even if they later get canceled by another call to ScheduleTasks(). 182 // even if they later get canceled by another call to ScheduleTasks().
183 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; 183 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0;
184 184
185 // Returns the target that needs to be used for raster task resources. 185 // Returns the target that needs to be used for raster task resources.
186 virtual GLenum GetResourceTarget() const = 0; 186 virtual GLenum GetResourceTarget() const = 0;
187 187
188 // Returns the format that needs to be used for raster task resources. 188 // Returns the format that needs to be used for raster task resources.
189 virtual ResourceFormat GetResourceFormat() const = 0; 189 virtual ResourceFormat GetResourceFormat() const = 0;
190 190
191 // Sets the number of threads to use for running raster tasks.
192 // Can only be called once prior to GetNumRasterThreads().
193 // Caller is responsible for correct ordering.
194 static void SetNumRasterThreads();
195
196 // Gets the number of threads to use for running raster tasks.
197 static int GetNumRasterThreads();
198
191 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters. 199 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters.
192 static RasterTask CreateRasterTask( 200 static RasterTask CreateRasterTask(
193 const Resource* resource, 201 const Resource* resource,
194 PicturePileImpl* picture_pile, 202 PicturePileImpl* picture_pile,
195 gfx::Rect content_rect, 203 gfx::Rect content_rect,
196 float contents_scale, 204 float contents_scale,
197 RasterMode raster_mode, 205 RasterMode raster_mode,
198 TileResolution tile_resolution, 206 TileResolution tile_resolution,
199 int layer_id, 207 int layer_id,
200 const void* tile_id, 208 const void* tile_id,
(...skipping 10 matching lines...) Expand all
211 219
212 protected: 220 protected:
213 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; 221 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector;
214 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > 222 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> >
215 RasterTaskVector; 223 RasterTaskVector;
216 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet; 224 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet;
217 typedef internal::RasterWorkerPoolTask* TaskMapKey; 225 typedef internal::RasterWorkerPoolTask* TaskMapKey;
218 typedef base::hash_map<TaskMapKey, 226 typedef base::hash_map<TaskMapKey,
219 scoped_refptr<internal::WorkerPoolTask> > TaskMap; 227 scoped_refptr<internal::WorkerPoolTask> > TaskMap;
220 228
221 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads); 229 explicit RasterWorkerPool(ResourceProvider* resource_provider);
222 230
223 virtual void OnRasterTasksFinished() = 0; 231 virtual void OnRasterTasksFinished() = 0;
224 virtual void OnRasterTasksRequiredForActivationFinished() = 0; 232 virtual void OnRasterTasksRequiredForActivationFinished() = 0;
225 233
226 void SetRasterTasks(RasterTask::Queue* queue); 234 void SetRasterTasks(RasterTask::Queue* queue);
227 bool IsRasterTaskRequiredForActivation( 235 bool IsRasterTaskRequiredForActivation(
228 internal::RasterWorkerPoolTask* task) const; 236 internal::RasterWorkerPoolTask* task) const;
229 237
230 RasterWorkerPoolClient* client() const { return client_; } 238 RasterWorkerPoolClient* client() const { return client_; }
231 ResourceProvider* resource_provider() const { return resource_provider_; } 239 ResourceProvider* resource_provider() const { return resource_provider_; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 276
269 RasterWorkerPoolClient* client_; 277 RasterWorkerPoolClient* client_;
270 ResourceProvider* resource_provider_; 278 ResourceProvider* resource_provider_;
271 RasterTask::Queue::TaskVector raster_tasks_; 279 RasterTask::Queue::TaskVector raster_tasks_;
272 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; 280 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_;
273 281
274 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 282 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
275 scoped_refptr<internal::WorkerPoolTask> 283 scoped_refptr<internal::WorkerPoolTask>
276 raster_required_for_activation_finished_task_; 284 raster_required_for_activation_finished_task_;
277 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 285 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
286 static int num_raster_threads_;
reveman 2014/01/06 07:13:12 no need for this to be in the header. put it in an
sohanjg 2014/01/06 09:57:29 Done.
278 }; 287 };
279 288
280 } // namespace cc 289 } // namespace cc
281 290
282 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 291 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698