OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tiles/gpu_image_decode_controller.h" | 5 #include "cc/tiles/gpu_image_decode_controller.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include "base/memory/discardable_memory_allocator.h" | 9 #include "base/memory/discardable_memory_allocator.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 ~ImageUploadTaskImpl() override {} | 210 ~ImageUploadTaskImpl() override {} |
211 | 211 |
212 private: | 212 private: |
213 GpuImageDecodeController* controller_; | 213 GpuImageDecodeController* controller_; |
214 DrawImage image_; | 214 DrawImage image_; |
215 const ImageDecodeController::TracingInfo tracing_info_; | 215 const ImageDecodeController::TracingInfo tracing_info_; |
216 | 216 |
217 DISALLOW_COPY_AND_ASSIGN(ImageUploadTaskImpl); | 217 DISALLOW_COPY_AND_ASSIGN(ImageUploadTaskImpl); |
218 }; | 218 }; |
219 | 219 |
220 GpuImageDecodeController::DecodedImageData::DecodedImageData() = default; | 220 GpuImageDecodeController::DecodedImageData::DecodedImageData() = default; |
tasak
2016/08/26 10:08:05
Need to register this from ChildMemoryCoordinator
| |
221 GpuImageDecodeController::DecodedImageData::~DecodedImageData() { | 221 GpuImageDecodeController::DecodedImageData::~DecodedImageData() { |
222 ResetData(); | 222 ResetData(); |
tasak
2016/08/26 10:08:05
Need to unregister this from ChildMemoryCoordinato
| |
223 } | 223 } |
224 | 224 |
225 bool GpuImageDecodeController::DecodedImageData::Lock() { | 225 bool GpuImageDecodeController::DecodedImageData::Lock() { |
226 DCHECK(!is_locked_); | 226 DCHECK(!is_locked_); |
227 is_locked_ = data_->Lock(); | 227 is_locked_ = data_->Lock(); |
228 if (is_locked_) | 228 if (is_locked_) |
229 ++usage_stats_.lock_count; | 229 ++usage_stats_.lock_count; |
230 return is_locked_; | 230 return is_locked_; |
231 } | 231 } |
232 | 232 |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 | 1127 |
1128 bool GpuImageDecodeController::DiscardableIsLockedForTesting( | 1128 bool GpuImageDecodeController::DiscardableIsLockedForTesting( |
1129 const DrawImage& image) { | 1129 const DrawImage& image) { |
1130 base::AutoLock lock(lock_); | 1130 base::AutoLock lock(lock_); |
1131 auto found = persistent_cache_.Peek(image.image()->uniqueID()); | 1131 auto found = persistent_cache_.Peek(image.image()->uniqueID()); |
1132 DCHECK(found != persistent_cache_.end()); | 1132 DCHECK(found != persistent_cache_.end()); |
1133 ImageData* image_data = found->second.get(); | 1133 ImageData* image_data = found->second.get(); |
1134 return image_data->decode.is_locked(); | 1134 return image_data->decode.is_locked(); |
1135 } | 1135 } |
1136 | 1136 |
1137 void GpuImageDecodeController::OnMemoryStateChange( | |
1138 memory_coordinator::mojom::MemoryState state) { | |
1139 if (state == memory_coordinator::mojom::MemoryState::SUSPENDED) | |
1140 SetShouldAggressivelyFreeResources(true); | |
ericrk
2016/08/31 17:50:32
Setting this is stateful, so we need to be careful
| |
1141 } | |
1142 | |
1137 } // namespace cc | 1143 } // namespace cc |
OLD | NEW |