| 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_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 |
| 11 #include "cc/debug/rendering_stats_instrumentation.h" | 11 #include "cc/debug/rendering_stats_instrumentation.h" |
| 12 #include "cc/resources/picture_pile_impl.h" | 12 #include "cc/resources/picture_pile_impl.h" |
| 13 #include "cc/resources/raster_mode.h" | 13 #include "cc/resources/raster_mode.h" |
| 14 #include "cc/resources/resource_format.h" | 14 #include "cc/resources/resource_format.h" |
| 15 #include "cc/resources/task_graph_runner.h" | 15 #include "cc/resources/task_graph_runner.h" |
| 16 #include "cc/resources/tile_priority.h" | 16 #include "cc/resources/tile_priority.h" |
| 17 | 17 |
| 18 class SkPixelRef; | 18 class SkPixelRef; |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class ContextProvider; | 22 class ContextProvider; |
| 23 class Resource; | 23 class Resource; |
| 24 class ResourceProvider; | 24 class ResourceProvider; |
| 25 | 25 |
| 26 namespace internal { | 26 namespace internal { |
| 27 | 27 |
| 28 class WorkerPoolTask; | 28 class WorkerPoolTask; |
| 29 class RasterWorkerPoolTask; |
| 29 | 30 |
| 30 class CC_EXPORT WorkerPoolTaskClient { | 31 class CC_EXPORT WorkerPoolTaskClient { |
| 31 public: | 32 public: |
| 32 virtual SkCanvas* AcquireCanvasForRaster(WorkerPoolTask* task, | 33 virtual SkCanvas* AcquireCanvasForRaster(RasterWorkerPoolTask* task) = 0; |
| 33 const Resource* resource) = 0; | 34 virtual void OnRasterCompleted(RasterWorkerPoolTask* task, |
| 34 virtual void ReleaseCanvasForRaster(WorkerPoolTask* task, | 35 const PicturePileImpl::Analysis& analysis) = 0; |
| 35 const Resource* resource) = 0; | 36 virtual void OnImageDecodeCompleted(WorkerPoolTask* task) = 0; |
| 36 | 37 |
| 37 protected: | 38 protected: |
| 38 virtual ~WorkerPoolTaskClient() {} | 39 virtual ~WorkerPoolTaskClient() {} |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 class CC_EXPORT WorkerPoolTask : public Task { | 42 class CC_EXPORT WorkerPoolTask : public Task { |
| 42 public: | 43 public: |
| 43 typedef std::vector<scoped_refptr<WorkerPoolTask> > Vector; | 44 typedef std::vector<scoped_refptr<WorkerPoolTask> > Vector; |
| 44 | 45 |
| 45 virtual void ScheduleOnOriginThread(WorkerPoolTaskClient* client) = 0; | 46 virtual void ScheduleOnOriginThread(WorkerPoolTaskClient* client) = 0; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 virtual void DidFinishRunningTasksRequiredForActivation() = 0; | 90 virtual void DidFinishRunningTasksRequiredForActivation() = 0; |
| 90 | 91 |
| 91 protected: | 92 protected: |
| 92 virtual ~RasterWorkerPoolClient() {} | 93 virtual ~RasterWorkerPoolClient() {} |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 struct CC_EXPORT RasterTaskQueue { | 96 struct CC_EXPORT RasterTaskQueue { |
| 96 struct CC_EXPORT Item { | 97 struct CC_EXPORT Item { |
| 97 class TaskComparator { | 98 class TaskComparator { |
| 98 public: | 99 public: |
| 99 explicit TaskComparator(const internal::WorkerPoolTask* task) | 100 explicit TaskComparator(const internal::RasterWorkerPoolTask* task) |
| 100 : task_(task) {} | 101 : task_(task) {} |
| 101 | 102 |
| 102 bool operator()(const Item& item) const { return item.task == task_; } | 103 bool operator()(const Item& item) const { return item.task == task_; } |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 const internal::WorkerPoolTask* task_; | 106 const internal::RasterWorkerPoolTask* task_; |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 typedef std::vector<Item> Vector; | 109 typedef std::vector<Item> Vector; |
| 109 | 110 |
| 110 Item(internal::RasterWorkerPoolTask* task, bool required_for_activation); | 111 Item(internal::RasterWorkerPoolTask* task, bool required_for_activation); |
| 111 ~Item(); | 112 ~Item(); |
| 112 | 113 |
| 113 static bool IsRequiredForActivation(const Item& item) { | 114 static bool IsRequiredForActivation(const Item& item) { |
| 114 return item.required_for_activation; | 115 return item.required_for_activation; |
| 115 } | 116 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 254 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
| 254 scoped_refptr<internal::WorkerPoolTask> | 255 scoped_refptr<internal::WorkerPoolTask> |
| 255 raster_required_for_activation_finished_task_; | 256 raster_required_for_activation_finished_task_; |
| 256 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 257 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
| 257 }; | 258 }; |
| 258 | 259 |
| 259 } // namespace cc | 260 } // namespace cc |
| 260 | 261 |
| 261 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 262 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
| OLD | NEW |