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

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: Rebase for Commit 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 <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Once scheduled, reply callbacks are guaranteed to run for all tasks 185 // Once scheduled, reply callbacks are guaranteed to run for all tasks
186 // even if they later get canceled by another call to ScheduleTasks(). 186 // even if they later get canceled by another call to ScheduleTasks().
187 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; 187 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0;
188 188
189 // Returns the target that needs to be used for raster task resources. 189 // Returns the target that needs to be used for raster task resources.
190 virtual GLenum GetResourceTarget() const = 0; 190 virtual GLenum GetResourceTarget() const = 0;
191 191
192 // Returns the format that needs to be used for raster task resources. 192 // Returns the format that needs to be used for raster task resources.
193 virtual ResourceFormat GetResourceFormat() const = 0; 193 virtual ResourceFormat GetResourceFormat() const = 0;
194 194
195 // Sets the number of threads to use for running raster tasks.
196 // Can only be called once prior to GetNumRasterThreads().
197 // Caller is responsible for correct ordering.
198 static void SetNumRasterThreads(int num_threads);
199
195 // Force a check for completed raster tasks. 200 // Force a check for completed raster tasks.
196 // Calls completion callbacks on completed tasks. 201 // Calls completion callbacks on completed tasks.
197 virtual void CheckForCompletedTasks(); 202 virtual void CheckForCompletedTasks();
198 203
199 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters. 204 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters.
200 static RasterTask CreateRasterTask( 205 static RasterTask CreateRasterTask(
201 const Resource* resource, 206 const Resource* resource,
202 PicturePileImpl* picture_pile, 207 PicturePileImpl* picture_pile,
203 const gfx::Rect& content_rect, 208 const gfx::Rect& content_rect,
204 float contents_scale, 209 float contents_scale,
(...skipping 18 matching lines...) Expand all
223 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > 228 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> >
224 RasterTaskVector; 229 RasterTaskVector;
225 typedef std::deque<scoped_refptr<internal::RasterWorkerPoolTask> > 230 typedef std::deque<scoped_refptr<internal::RasterWorkerPoolTask> >
226 RasterTaskDeque; 231 RasterTaskDeque;
227 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet; 232 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet;
228 typedef internal::RasterWorkerPoolTask* TaskMapKey; 233 typedef internal::RasterWorkerPoolTask* TaskMapKey;
229 typedef base::hash_map<TaskMapKey, 234 typedef base::hash_map<TaskMapKey,
230 scoped_refptr<internal::WorkerPoolTask> > TaskMap; 235 scoped_refptr<internal::WorkerPoolTask> > TaskMap;
231 236
232 RasterWorkerPool(ResourceProvider* resource_provider, 237 RasterWorkerPool(ResourceProvider* resource_provider,
233 ContextProvider* context_provider, 238 ContextProvider* context_provider);
234 size_t num_threads);
235 239
236 virtual void OnRasterTasksFinished() = 0; 240 virtual void OnRasterTasksFinished() = 0;
237 virtual void OnRasterTasksRequiredForActivationFinished() = 0; 241 virtual void OnRasterTasksRequiredForActivationFinished() = 0;
238 242
239 void SetRasterTasks(RasterTask::Queue* queue); 243 void SetRasterTasks(RasterTask::Queue* queue);
240 bool IsRasterTaskRequiredForActivation( 244 bool IsRasterTaskRequiredForActivation(
241 internal::RasterWorkerPoolTask* task) const; 245 internal::RasterWorkerPoolTask* task) const;
242 // Run raster tasks that use GPU on current thread. 246 // Run raster tasks that use GPU on current thread.
243 void RunGpuRasterTasks(const RasterTaskVector& tasks); 247 void RunGpuRasterTasks(const RasterTaskVector& tasks);
244 248
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 296
293 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 297 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
294 scoped_refptr<internal::WorkerPoolTask> 298 scoped_refptr<internal::WorkerPoolTask>
295 raster_required_for_activation_finished_task_; 299 raster_required_for_activation_finished_task_;
296 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 300 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
297 }; 301 };
298 302
299 } // namespace cc 303 } // namespace cc
300 304
301 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 305 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698