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/resources/pixel_buffer_raster_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_raster_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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/debug/trace_event_argument.h" | 11 #include "base/debug/trace_event_argument.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "cc/debug/traced_value.h" | 13 #include "cc/debug/traced_value.h" |
14 #include "cc/resources/raster_buffer.h" | 14 #include "cc/resources/raster_buffer.h" |
15 #include "cc/resources/resource.h" | 15 #include "cc/resources/resource.h" |
16 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
17 #include "third_party/skia/include/utils/SkNullCanvas.h" | 17 #include "third_party/skia/include/utils/SkNullCanvas.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 namespace { | 20 namespace { |
21 | 21 |
22 class RasterBufferImpl : public RasterBuffer { | 22 class RasterBufferImpl : public RasterBuffer { |
23 public: | 23 public: |
24 RasterBufferImpl(ResourceProvider* resource_provider, | 24 RasterBufferImpl(ResourceProvider* resource_provider, |
25 const Resource* resource) | 25 const Resource* resource) |
26 : resource_provider_(resource_provider), | 26 : resource_provider_(resource_provider), |
27 resource_(resource), | 27 resource_(resource), |
28 buffer_(NULL), | 28 buffer_(nullptr), |
29 stride_(0) { | 29 stride_(0) { |
30 resource_provider_->AcquirePixelBuffer(resource_->id()); | 30 resource_provider_->AcquirePixelBuffer(resource_->id()); |
31 buffer_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); | 31 buffer_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); |
32 } | 32 } |
33 | 33 |
34 virtual ~RasterBufferImpl() { | 34 virtual ~RasterBufferImpl() { |
35 resource_provider_->ReleasePixelBuffer(resource_->id()); | 35 resource_provider_->ReleasePixelBuffer(resource_->id()); |
36 } | 36 } |
37 | 37 |
38 // Overridden from RasterBuffer: | 38 // Overridden from RasterBuffer: |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( | 747 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( |
748 base::debug::TracedValue* throttle_state) const { | 748 base::debug::TracedValue* throttle_state) const { |
749 throttle_state->SetInteger("bytes_available_for_upload", | 749 throttle_state->SetInteger("bytes_available_for_upload", |
750 max_bytes_pending_upload_ - bytes_pending_upload_); | 750 max_bytes_pending_upload_ - bytes_pending_upload_); |
751 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 751 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
752 throttle_state->SetInteger("scheduled_raster_task_count", | 752 throttle_state->SetInteger("scheduled_raster_task_count", |
753 scheduled_raster_task_count_); | 753 scheduled_raster_task_count_); |
754 } | 754 } |
755 | 755 |
756 } // namespace cc | 756 } // namespace cc |
OLD | NEW |