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/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
15 #include "base/trace_event/trace_event_argument.h" | 16 #include "base/trace_event/trace_event_argument.h" |
16 #include "cc/debug/traced_value.h" | 17 #include "cc/debug/traced_value.h" |
17 #include "cc/playback/raster_source.h" | 18 #include "cc/playback/raster_source.h" |
18 #include "cc/raster/raster_buffer.h" | 19 #include "cc/raster/raster_buffer.h" |
19 #include "cc/resources/platform_color.h" | 20 #include "cc/resources/platform_color.h" |
20 #include "cc/resources/resource.h" | 21 #include "cc/resources/resource.h" |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ResourceProvider::ScopedWriteLockSoftware lock_; | 61 ResourceProvider::ScopedWriteLockSoftware lock_; |
61 const Resource* resource_; | 62 const Resource* resource_; |
62 bool resource_has_previous_content_; | 63 bool resource_has_previous_content_; |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 65 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace | 68 } // namespace |
68 | 69 |
69 // static | 70 // static |
70 scoped_ptr<TileTaskWorkerPool> BitmapTileTaskWorkerPool::Create( | 71 std::unique_ptr<TileTaskWorkerPool> BitmapTileTaskWorkerPool::Create( |
71 base::SequencedTaskRunner* task_runner, | 72 base::SequencedTaskRunner* task_runner, |
72 TaskGraphRunner* task_graph_runner, | 73 TaskGraphRunner* task_graph_runner, |
73 ResourceProvider* resource_provider) { | 74 ResourceProvider* resource_provider) { |
74 return make_scoped_ptr<TileTaskWorkerPool>(new BitmapTileTaskWorkerPool( | 75 return base::WrapUnique<TileTaskWorkerPool>(new BitmapTileTaskWorkerPool( |
75 task_runner, task_graph_runner, resource_provider)); | 76 task_runner, task_graph_runner, resource_provider)); |
76 } | 77 } |
77 | 78 |
78 BitmapTileTaskWorkerPool::BitmapTileTaskWorkerPool( | 79 BitmapTileTaskWorkerPool::BitmapTileTaskWorkerPool( |
79 base::SequencedTaskRunner* task_runner, | 80 base::SequencedTaskRunner* task_runner, |
80 TaskGraphRunner* task_graph_runner, | 81 TaskGraphRunner* task_graph_runner, |
81 ResourceProvider* resource_provider) | 82 ResourceProvider* resource_provider) |
82 : task_runner_(task_runner), | 83 : task_runner_(task_runner), |
83 task_graph_runner_(task_graph_runner), | 84 task_graph_runner_(task_graph_runner), |
84 namespace_token_(task_graph_runner->GetNamespaceToken()), | 85 namespace_token_(task_graph_runner->GetNamespaceToken()), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( | 126 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( |
126 bool must_support_alpha) const { | 127 bool must_support_alpha) const { |
127 return resource_provider_->best_texture_format(); | 128 return resource_provider_->best_texture_format(); |
128 } | 129 } |
129 | 130 |
130 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( | 131 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( |
131 bool must_support_alpha) const { | 132 bool must_support_alpha) const { |
132 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 133 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
133 } | 134 } |
134 | 135 |
135 scoped_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( | 136 std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( |
136 const Resource* resource, | 137 const Resource* resource, |
137 uint64_t resource_content_id, | 138 uint64_t resource_content_id, |
138 uint64_t previous_content_id) { | 139 uint64_t previous_content_id) { |
139 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 140 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( |
140 resource_provider_, resource, resource_content_id, previous_content_id)); | 141 resource_provider_, resource, resource_content_id, previous_content_id)); |
141 } | 142 } |
142 | 143 |
143 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 144 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
144 scoped_ptr<RasterBuffer> buffer) { | 145 std::unique_ptr<RasterBuffer> buffer) { |
145 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 146 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
146 } | 147 } |
147 | 148 |
148 } // namespace cc | 149 } // namespace cc |
OLD | NEW |