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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 protected: | 40 protected: |
41 virtual ~WorkerPoolTaskClient() {} | 41 virtual ~WorkerPoolTaskClient() {} |
42 }; | 42 }; |
43 | 43 |
44 class CC_EXPORT WorkerPoolTask : public Task { | 44 class CC_EXPORT WorkerPoolTask : public Task { |
45 public: | 45 public: |
46 virtual void ScheduleOnOriginThread(WorkerPoolTaskClient* client) = 0; | 46 virtual void ScheduleOnOriginThread(WorkerPoolTaskClient* client) = 0; |
47 virtual void CompleteOnOriginThread(WorkerPoolTaskClient* client) = 0; | 47 virtual void CompleteOnOriginThread(WorkerPoolTaskClient* client) = 0; |
48 virtual void RunReplyOnOriginThread() = 0; | 48 virtual void RunReplyOnOriginThread() = 0; |
49 | 49 |
| 50 void WillSchedule(); |
| 51 void DidSchedule(); |
| 52 bool HasBeenScheduled() const; |
| 53 |
50 void WillComplete(); | 54 void WillComplete(); |
51 void DidComplete(); | 55 void DidComplete(); |
52 bool HasCompleted() const; | 56 bool HasCompleted() const; |
53 | 57 |
54 protected: | 58 protected: |
55 WorkerPoolTask(); | 59 WorkerPoolTask(); |
56 virtual ~WorkerPoolTask(); | 60 virtual ~WorkerPoolTask(); |
57 | 61 |
58 private: | 62 private: |
| 63 bool did_schedule_; |
59 bool did_complete_; | 64 bool did_complete_; |
60 }; | 65 }; |
61 | 66 |
62 class CC_EXPORT RasterWorkerPoolTask : public WorkerPoolTask { | 67 class CC_EXPORT RasterWorkerPoolTask : public WorkerPoolTask { |
63 public: | 68 public: |
64 virtual void RunOnOriginThread(ResourceProvider* resource_provider, | 69 virtual void RunOnOriginThread(ResourceProvider* resource_provider, |
65 ContextProvider* context_provider) = 0; | 70 ContextProvider* context_provider) = 0; |
66 | 71 |
67 const Resource* resource() const { return resource_; } | 72 const Resource* resource() const { return resource_; } |
68 const internal::Task::Vector& dependencies() const { return dependencies_; } | 73 const internal::Task::Vector& dependencies() const { return dependencies_; } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 public: | 105 public: |
101 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; | 106 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; |
102 virtual void DidFinishRunningTasks() = 0; | 107 virtual void DidFinishRunningTasks() = 0; |
103 virtual void DidFinishRunningTasksRequiredForActivation() = 0; | 108 virtual void DidFinishRunningTasksRequiredForActivation() = 0; |
104 | 109 |
105 protected: | 110 protected: |
106 virtual ~RasterWorkerPoolClient() {} | 111 virtual ~RasterWorkerPoolClient() {} |
107 }; | 112 }; |
108 | 113 |
109 // A worker thread pool that runs raster tasks. | 114 // A worker thread pool that runs raster tasks. |
110 class CC_EXPORT RasterWorkerPool { | 115 class CC_EXPORT RasterWorkerPool : public internal::WorkerPoolTaskClient { |
111 public: | 116 public: |
112 class CC_EXPORT Task { | 117 class CC_EXPORT Task { |
113 public: | 118 public: |
114 typedef base::Callback<void(bool was_canceled)> Reply; | 119 typedef base::Callback<void(bool was_canceled)> Reply; |
115 | 120 |
116 class CC_EXPORT Set { | 121 class CC_EXPORT Set { |
117 public: | 122 public: |
118 Set(); | 123 Set(); |
119 ~Set(); | 124 ~Set(); |
120 | 125 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 314 |
310 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 315 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
311 scoped_refptr<internal::WorkerPoolTask> | 316 scoped_refptr<internal::WorkerPoolTask> |
312 raster_required_for_activation_finished_task_; | 317 raster_required_for_activation_finished_task_; |
313 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 318 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
314 }; | 319 }; |
315 | 320 |
316 } // namespace cc | 321 } // namespace cc |
317 | 322 |
318 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 323 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
OLD | NEW |