| 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/image_controller.h" | 5 #include "cc/tiles/image_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/task_scheduler/post_task.h" | 8 #include "base/task_scheduler/post_task.h" |
| 9 #include "base/task_scheduler/task_traits.h" | 9 #include "base/task_scheduler/task_traits.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 image_decode_queue_.clear(); | 120 image_decode_queue_.clear(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ImageController::SetImageDecodeCache(ImageDecodeCache* cache) { | 123 void ImageController::SetImageDecodeCache(ImageDecodeCache* cache) { |
| 124 DCHECK(!cache_ || !cache); | 124 DCHECK(!cache_ || !cache); |
| 125 | 125 |
| 126 if (!cache) { | 126 if (!cache) { |
| 127 SetPredecodeImages(std::vector<DrawImage>(), | 127 SetPredecodeImages(std::vector<DrawImage>(), |
| 128 ImageDecodeCache::TracingInfo()); | 128 ImageDecodeCache::TracingInfo()); |
| 129 StopWorkerTasks(); | 129 StopWorkerTasks(); |
| 130 image_cache_max_limit_bytes_ = 0u; |
| 130 } | 131 } |
| 131 | 132 |
| 132 cache_ = cache; | 133 cache_ = cache; |
| 133 | 134 |
| 134 if (cache_) | 135 if (cache_) { |
| 136 image_cache_max_limit_bytes_ = cache_->GetMaximumMemoryLimitBytes(); |
| 135 GenerateTasksForOrphanedRequests(); | 137 GenerateTasksForOrphanedRequests(); |
| 138 } |
| 136 } | 139 } |
| 137 | 140 |
| 138 void ImageController::GetTasksForImagesAndRef( | 141 void ImageController::GetTasksForImagesAndRef( |
| 139 std::vector<DrawImage>* images, | 142 std::vector<DrawImage>* images, |
| 140 std::vector<scoped_refptr<TileTask>>* tasks, | 143 std::vector<scoped_refptr<TileTask>>* tasks, |
| 141 const ImageDecodeCache::TracingInfo& tracing_info) { | 144 const ImageDecodeCache::TracingInfo& tracing_info) { |
| 142 DCHECK(cache_); | 145 DCHECK(cache_); |
| 143 for (auto it = images->begin(); it != images->end();) { | 146 for (auto it = images->begin(); it != images->end();) { |
| 144 scoped_refptr<TileTask> task; | 147 scoped_refptr<TileTask> task; |
| 145 bool need_to_unref_when_finished = | 148 bool need_to_unref_when_finished = |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 ImageController::ImageDecodeRequest::ImageDecodeRequest( | 374 ImageController::ImageDecodeRequest::ImageDecodeRequest( |
| 372 const ImageDecodeRequest& other) = default; | 375 const ImageDecodeRequest& other) = default; |
| 373 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; | 376 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; |
| 374 | 377 |
| 375 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 378 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
| 376 operator=(ImageDecodeRequest&& other) = default; | 379 operator=(ImageDecodeRequest&& other) = default; |
| 377 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 380 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
| 378 operator=(const ImageDecodeRequest& other) = default; | 381 operator=(const ImageDecodeRequest& other) = default; |
| 379 | 382 |
| 380 } // namespace cc | 383 } // namespace cc |
| OLD | NEW |