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/one_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "base/trace_event/memory_dump_manager.h" | 16 #include "base/trace_event/memory_dump_manager.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "base/trace_event/trace_event_argument.h" | 18 #include "base/trace_event/trace_event_argument.h" |
19 #include "cc/base/container_util.h" | 19 #include "cc/base/container_util.h" |
20 #include "cc/base/math_util.h" | 20 #include "cc/base/math_util.h" |
21 #include "cc/debug/traced_value.h" | 21 #include "cc/debug/traced_value.h" |
22 #include "cc/raster/raster_buffer.h" | |
23 #include "cc/resources/platform_color.h" | 22 #include "cc/resources/platform_color.h" |
24 #include "cc/resources/resource_format.h" | 23 #include "cc/resources/resource_format.h" |
25 #include "cc/resources/resource_util.h" | 24 #include "cc/resources/resource_util.h" |
26 #include "cc/resources/scoped_resource.h" | 25 #include "cc/resources/scoped_resource.h" |
27 #include "gpu/GLES2/gl2extchromium.h" | 26 #include "gpu/GLES2/gl2extchromium.h" |
28 #include "gpu/command_buffer/client/gles2_interface.h" | 27 #include "gpu/command_buffer/client/gles2_interface.h" |
29 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 28 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
30 #include "ui/gfx/buffer_format_util.h" | 29 #include "ui/gfx/buffer_format_util.h" |
31 | 30 |
32 namespace cc { | 31 namespace cc { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return; | 248 return; |
250 | 249 |
251 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 250 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
252 DCHECK_EQ(staging_buffer_usage_in_bytes_, 0); | 251 DCHECK_EQ(staging_buffer_usage_in_bytes_, 0); |
253 DCHECK_EQ(free_staging_buffer_usage_in_bytes_, 0); | 252 DCHECK_EQ(free_staging_buffer_usage_in_bytes_, 0); |
254 } | 253 } |
255 | 254 |
256 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { | 255 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { |
257 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks"); | 256 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks"); |
258 | 257 |
259 ScheduleTasksOnOriginThread(this, graph); | 258 ScheduleTasksOnOriginThread(graph); |
260 | 259 |
261 // Barrier to sync any new resources to the worker context. | 260 // Barrier to sync any new resources to the worker context. |
262 resource_provider_->output_surface() | 261 resource_provider_->output_surface() |
263 ->context_provider() | 262 ->context_provider() |
264 ->ContextGL() | 263 ->ContextGL() |
265 ->OrderingBarrierCHROMIUM(); | 264 ->OrderingBarrierCHROMIUM(); |
266 | 265 |
267 task_graph_runner_->ScheduleTasks(namespace_token_, graph); | 266 task_graph_runner_->ScheduleTasks(namespace_token_, graph); |
268 } | 267 } |
269 | 268 |
270 void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { | 269 void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { |
271 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks"); | 270 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks"); |
272 | 271 |
273 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 272 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
274 &completed_tasks_); | 273 &completed_tasks_); |
275 | 274 |
276 for (Task::Vector::const_iterator it = completed_tasks_.begin(); | 275 for (Task::Vector::const_iterator it = completed_tasks_.begin(); |
277 it != completed_tasks_.end(); ++it) { | 276 it != completed_tasks_.end(); ++it) { |
278 TileTask* task = static_cast<TileTask*>(it->get()); | 277 Task* task = it->get(); |
279 | 278 |
280 task->WillComplete(); | 279 task->WillComplete(); |
281 task->CompleteOnOriginThread(this); | 280 task->CompleteOnOriginThread(); |
282 task->DidComplete(); | 281 task->DidComplete(); |
283 } | 282 } |
284 completed_tasks_.clear(); | 283 completed_tasks_.clear(); |
285 } | 284 } |
286 | 285 |
287 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( | 286 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( |
288 bool must_support_alpha) const { | 287 bool must_support_alpha) const { |
289 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && | 288 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && |
290 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || | 289 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || |
291 !must_support_alpha)) { | 290 !must_support_alpha)) { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return; | 736 return; |
738 | 737 |
739 busy_buffers_.front()->DestroyGLResources(gl); | 738 busy_buffers_.front()->DestroyGLResources(gl); |
740 RemoveStagingBuffer(busy_buffers_.front().get()); | 739 RemoveStagingBuffer(busy_buffers_.front().get()); |
741 busy_buffers_.pop_front(); | 740 busy_buffers_.pop_front(); |
742 } | 741 } |
743 } | 742 } |
744 } | 743 } |
745 | 744 |
746 } // namespace cc | 745 } // namespace cc |
OLD | NEW |