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/resources/one_copy_raster_worker_pool.h" | 5 #include "cc/resources/one_copy_raster_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/debug/trace_event_argument.h" | 10 #include "base/debug/trace_event_argument.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // used by the GPU. Read lock fences are required to ensure that we're not | 46 // used by the GPU. Read lock fences are required to ensure that we're not |
47 // trying to map a resource that is currently in-use by the GPU. | 47 // trying to map a resource that is currently in-use by the GPU. |
48 resource_provider_->EnableReadLockFences(raster_resource_->id()); | 48 resource_provider_->EnableReadLockFences(raster_resource_->id()); |
49 | 49 |
50 // Return raster resource to pool so it can be used by another RasterBuffer | 50 // Return raster resource to pool so it can be used by another RasterBuffer |
51 // instance. | 51 // instance. |
52 resource_pool_->ReleaseResource(raster_resource_.Pass()); | 52 resource_pool_->ReleaseResource(raster_resource_.Pass()); |
53 } | 53 } |
54 | 54 |
55 // Overridden from RasterBuffer: | 55 // Overridden from RasterBuffer: |
56 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() OVERRIDE { | 56 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { |
57 if (!buffer_) | 57 if (!buffer_) |
58 return skia::AdoptRef(SkCreateNullCanvas()); | 58 return skia::AdoptRef(SkCreateNullCanvas()); |
59 | 59 |
60 RasterWorkerPool::AcquireBitmapForBuffer( | 60 RasterWorkerPool::AcquireBitmapForBuffer( |
61 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); | 61 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); |
62 return skia::AdoptRef(new SkCanvas(bitmap_)); | 62 return skia::AdoptRef(new SkCanvas(bitmap_)); |
63 } | 63 } |
64 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) OVERRIDE { | 64 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { |
65 if (!buffer_) | 65 if (!buffer_) |
66 return; | 66 return; |
67 | 67 |
68 RasterWorkerPool::ReleaseBitmapForBuffer( | 68 RasterWorkerPool::ReleaseBitmapForBuffer( |
69 &bitmap_, buffer_, resource_->format()); | 69 &bitmap_, buffer_, resource_->format()); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 ResourceProvider* resource_provider_; | 73 ResourceProvider* resource_provider_; |
74 ResourcePool* resource_pool_; | 74 ResourcePool* resource_pool_; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 resource_pool_->total_memory_usage_bytes()); | 274 resource_pool_->total_memory_usage_bytes()); |
275 staging_state->SetInteger("pending_copy_count", | 275 staging_state->SetInteger("pending_copy_count", |
276 resource_pool_->total_resource_count() - | 276 resource_pool_->total_resource_count() - |
277 resource_pool_->acquired_resource_count()); | 277 resource_pool_->acquired_resource_count()); |
278 staging_state->SetInteger("bytes_pending_copy", | 278 staging_state->SetInteger("bytes_pending_copy", |
279 resource_pool_->total_memory_usage_bytes() - | 279 resource_pool_->total_memory_usage_bytes() - |
280 resource_pool_->acquired_memory_usage_bytes()); | 280 resource_pool_->acquired_memory_usage_bytes()); |
281 } | 281 } |
282 | 282 |
283 } // namespace cc | 283 } // namespace cc |
OLD | NEW |