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 #include "cc/raster/pixel_buffer_tile_task_worker_pool.h" | 5 #include "cc/raster/pixel_buffer_tile_task_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "base/trace_event/trace_event_argument.h" | 12 #include "base/trace_event/trace_event_argument.h" |
13 #include "cc/debug/traced_value.h" | 13 #include "cc/debug/traced_value.h" |
14 #include "cc/raster/raster_buffer.h" | 14 #include "cc/raster/raster_buffer.h" |
| 15 #include "cc/resources/platform_color.h" |
15 #include "cc/resources/resource.h" | 16 #include "cc/resources/resource.h" |
16 #include "gpu/command_buffer/client/gles2_interface.h" | 17 #include "gpu/command_buffer/client/gles2_interface.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 namespace { | 20 namespace { |
20 | 21 |
21 class RasterBufferImpl : public RasterBuffer { | 22 class RasterBufferImpl : public RasterBuffer { |
22 public: | 23 public: |
23 RasterBufferImpl(ResourceProvider* resource_provider, | 24 RasterBufferImpl(ResourceProvider* resource_provider, |
24 const Resource* resource) | 25 const Resource* resource) |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 DCHECK_EQ(RasterTaskState::COMPLETED, state_it->type); | 306 DCHECK_EQ(RasterTaskState::COMPLETED, state_it->type); |
306 | 307 |
307 std::swap(*state_it, raster_task_states_.back()); | 308 std::swap(*state_it, raster_task_states_.back()); |
308 raster_task_states_.pop_back(); | 309 raster_task_states_.pop_back(); |
309 | 310 |
310 task->RunReplyOnOriginThread(); | 311 task->RunReplyOnOriginThread(); |
311 } | 312 } |
312 completed_raster_tasks_.clear(); | 313 completed_raster_tasks_.clear(); |
313 } | 314 } |
314 | 315 |
315 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() { | 316 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() const { |
316 return resource_provider_->memory_efficient_texture_format(); | 317 return resource_provider_->memory_efficient_texture_format(); |
317 } | 318 } |
318 | 319 |
| 320 bool PixelBufferTileTaskWorkerPool::GetResourceRequiresSwizzle() const { |
| 321 return !PlatformColor::SameComponentOrder(GetResourceFormat()); |
| 322 } |
| 323 |
319 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( | 324 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( |
320 const Resource* resource, | 325 const Resource* resource, |
321 uint64_t resource_content_id, | 326 uint64_t resource_content_id, |
322 uint64_t previous_content_id) { | 327 uint64_t previous_content_id) { |
323 return make_scoped_ptr<RasterBuffer>( | 328 return make_scoped_ptr<RasterBuffer>( |
324 new RasterBufferImpl(resource_provider_, resource)); | 329 new RasterBufferImpl(resource_provider_, resource)); |
325 } | 330 } |
326 | 331 |
327 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( | 332 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( |
328 scoped_ptr<RasterBuffer> buffer) { | 333 scoped_ptr<RasterBuffer> buffer) { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 throttle_state->SetInteger( | 745 throttle_state->SetInteger( |
741 "bytes_available_for_upload", | 746 "bytes_available_for_upload", |
742 static_cast<int>(max_bytes_pending_upload_ - bytes_pending_upload_)); | 747 static_cast<int>(max_bytes_pending_upload_ - bytes_pending_upload_)); |
743 throttle_state->SetInteger("bytes_pending_upload", | 748 throttle_state->SetInteger("bytes_pending_upload", |
744 static_cast<int>(bytes_pending_upload_)); | 749 static_cast<int>(bytes_pending_upload_)); |
745 throttle_state->SetInteger("scheduled_raster_task_count", | 750 throttle_state->SetInteger("scheduled_raster_task_count", |
746 static_cast<int>(scheduled_raster_task_count_)); | 751 static_cast<int>(scheduled_raster_task_count_)); |
747 } | 752 } |
748 | 753 |
749 } // namespace cc | 754 } // namespace cc |
OLD | NEW |