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 3 // found in the LICENSE file. 4 5 #ifndef CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_ 6 #define CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_ 7 8 #include "cc/resources/raster_worker_pool.h" 9 10 namespace cc { 11 12 class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool { 13 public: 14 virtual ~ImageRasterWorkerPool(); 15 16 static scoped_ptr<RasterWorkerPool> Create( 17 ResourceProvider* resource_provider, size_t num_threads) { 18 return make_scoped_ptr<RasterWorkerPool>( 19 new ImageRasterWorkerPool(resource_provider, num_threads)); 20 } 21 22 // Overridden from RasterWorkerPool: 23 virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE; 24 virtual void OnRasterTasksFinished() OVERRIDE; 25 virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE; 26 27 private: 28 ImageRasterWorkerPool(ResourceProvider* resource_provider, 29 size_t num_threads); 30 31 void OnRasterTaskCompleted( 32 scoped_refptr<internal::RasterWorkerPoolTask> task, bool was_canceled); 33 34 scoped_ptr<base::Value> StateAsValue() const; 35 36 static void CreateGraphNodeForImageTask( 37 internal::WorkerPoolTask* image_task, 38 const TaskVector& decode_tasks, 39 unsigned priority, 40 bool is_required_for_activation, 41 internal::GraphNode* raster_required_for_activation_finished_node, 42 internal::GraphNode* raster_finished_node, 43 TaskGraph* graph); 44 45 TaskMap image_tasks_; 46 47 bool raster_tasks_pending_; 48 bool raster_tasks_required_for_activation_pending_; 49 50 DISALLOW_COPY_AND_ASSIGN(ImageRasterWorkerPool); 51 }; 52 53 } // namespace cc 54 55 #endif // CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_ 56