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