| 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/zero_copy_raster_worker_pool.h" | 5 #include "cc/resources/zero_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 18 matching lines...) Expand all Loading... |
| 29 virtual ~RasterBufferImpl() { | 29 virtual ~RasterBufferImpl() { |
| 30 resource_provider_->UnmapImage(resource_->id()); | 30 resource_provider_->UnmapImage(resource_->id()); |
| 31 | 31 |
| 32 // This RasterBuffer implementation provides direct access to the memory | 32 // This RasterBuffer implementation provides direct access to the memory |
| 33 // used by the GPU. Read lock fences are required to ensure that we're not | 33 // used by the GPU. Read lock fences are required to ensure that we're not |
| 34 // trying to map a resource that is currently in-use by the GPU. | 34 // trying to map a resource that is currently in-use by the GPU. |
| 35 resource_provider_->EnableReadLockFences(resource_->id()); | 35 resource_provider_->EnableReadLockFences(resource_->id()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Overridden from RasterBuffer: | 38 // Overridden from RasterBuffer: |
| 39 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() OVERRIDE { | 39 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { |
| 40 if (!buffer_) | 40 if (!buffer_) |
| 41 return skia::AdoptRef(SkCreateNullCanvas()); | 41 return skia::AdoptRef(SkCreateNullCanvas()); |
| 42 | 42 |
| 43 RasterWorkerPool::AcquireBitmapForBuffer( | 43 RasterWorkerPool::AcquireBitmapForBuffer( |
| 44 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); | 44 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); |
| 45 return skia::AdoptRef(new SkCanvas(bitmap_)); | 45 return skia::AdoptRef(new SkCanvas(bitmap_)); |
| 46 } | 46 } |
| 47 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) OVERRIDE { | 47 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { |
| 48 if (!buffer_) | 48 if (!buffer_) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 RasterWorkerPool::ReleaseBitmapForBuffer( | 51 RasterWorkerPool::ReleaseBitmapForBuffer( |
| 52 &bitmap_, buffer_, resource_->format()); | 52 &bitmap_, buffer_, resource_->format()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 ResourceProvider* resource_provider_; | 56 ResourceProvider* resource_provider_; |
| 57 const Resource* resource_; | 57 const Resource* resource_; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 new base::debug::TracedValue(); | 224 new base::debug::TracedValue(); |
| 225 | 225 |
| 226 state->BeginArray("tasks_pending"); | 226 state->BeginArray("tasks_pending"); |
| 227 for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) | 227 for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) |
| 228 state->AppendBoolean(raster_pending_[task_set]); | 228 state->AppendBoolean(raster_pending_[task_set]); |
| 229 state->EndArray(); | 229 state->EndArray(); |
| 230 return state; | 230 return state; |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace cc | 233 } // namespace cc |
| OLD | NEW |