OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/raster/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown"); | 95 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown"); |
96 | 96 |
97 TaskGraph empty; | 97 TaskGraph empty; |
98 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); | 98 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); |
99 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); | 99 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); |
100 } | 100 } |
101 | 101 |
102 void BitmapTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { | 102 void BitmapTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { |
103 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks"); | 103 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks"); |
104 | 104 |
105 ScheduleTasksOnOriginThread(this, graph); | |
106 task_graph_runner_->ScheduleTasks(namespace_token_, graph); | 105 task_graph_runner_->ScheduleTasks(namespace_token_, graph); |
107 } | 106 } |
108 | 107 |
109 void BitmapTileTaskWorkerPool::CheckForCompletedTasks() { | 108 void BitmapTileTaskWorkerPool::CollectCompletedTasks( |
| 109 Task::Vector* completed_tasks) { |
110 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::CheckForCompletedTasks"); | 110 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::CheckForCompletedTasks"); |
111 | 111 |
112 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 112 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks); |
113 &completed_tasks_); | |
114 for (Task::Vector::const_iterator it = completed_tasks_.begin(); | |
115 it != completed_tasks_.end(); ++it) { | |
116 TileTask* task = static_cast<TileTask*>(it->get()); | |
117 | |
118 task->WillComplete(); | |
119 task->CompleteOnOriginThread(this); | |
120 task->DidComplete(); | |
121 } | |
122 completed_tasks_.clear(); | |
123 } | 113 } |
124 | 114 |
125 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( | 115 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( |
126 bool must_support_alpha) const { | 116 bool must_support_alpha) const { |
127 return resource_provider_->best_texture_format(); | 117 return resource_provider_->best_texture_format(); |
128 } | 118 } |
129 | 119 |
130 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( | 120 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( |
131 bool must_support_alpha) const { | 121 bool must_support_alpha) const { |
132 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 122 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
133 } | 123 } |
134 | 124 |
| 125 TileTaskClient* BitmapTileTaskWorkerPool::AsTileTaskClient() { |
| 126 return this; |
| 127 } |
| 128 |
135 scoped_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( | 129 scoped_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( |
136 const Resource* resource, | 130 const Resource* resource, |
137 uint64_t resource_content_id, | 131 uint64_t resource_content_id, |
138 uint64_t previous_content_id) { | 132 uint64_t previous_content_id) { |
139 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 133 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
140 resource_provider_, resource, resource_content_id, previous_content_id)); | 134 resource_provider_, resource, resource_content_id, previous_content_id)); |
141 } | 135 } |
142 | 136 |
143 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 137 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
144 scoped_ptr<RasterBuffer> buffer) { | 138 scoped_ptr<RasterBuffer> buffer) { |
145 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 139 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
146 } | 140 } |
147 | 141 |
148 } // namespace cc | 142 } // namespace cc |
OLD | NEW |