OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/checker_image_tracker.h" | 5 #include "cc/tiles/checker_image_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (images_pending_invalidation_.find(image->uniqueID()) != | 113 if (images_pending_invalidation_.find(image->uniqueID()) != |
114 images_pending_invalidation_.end()) { | 114 images_pending_invalidation_.end()) { |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 ImageId image_id = image->uniqueID(); | 118 ImageId image_id = image->uniqueID(); |
119 auto insert_result = image_async_decode_state_.insert( | 119 auto insert_result = image_async_decode_state_.insert( |
120 std::pair<ImageId, DecodePolicy>(image_id, DecodePolicy::ASYNC)); | 120 std::pair<ImageId, DecodePolicy>(image_id, DecodePolicy::ASYNC)); |
121 auto it = insert_result.first; | 121 auto it = insert_result.first; |
122 if (insert_result.second) { | 122 if (insert_result.second) { |
123 it->second = SafeSizeOfImage(image.get()) >= kMinImageSizeToCheckerBytes | 123 size_t size = SafeSizeOfImage(image.get()); |
| 124 it->second = (size >= kMinImageSizeToCheckerBytes && |
| 125 size <= image_controller_->image_cache_max_limit_bytes()) |
124 ? DecodePolicy::ASYNC | 126 ? DecodePolicy::ASYNC |
125 : DecodePolicy::SYNC_PERMANENT; | 127 : DecodePolicy::SYNC_PERMANENT; |
126 } | 128 } |
127 | 129 |
128 return it->second == DecodePolicy::ASYNC; | 130 return it->second == DecodePolicy::ASYNC; |
129 } | 131 } |
130 | 132 |
131 void CheckerImageTracker::ScheduleNextImageDecode() { | 133 void CheckerImageTracker::ScheduleNextImageDecode() { |
132 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 134 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
133 "CheckerImageTracker::ScheduleNextImageDecode"); | 135 "CheckerImageTracker::ScheduleNextImageDecode"); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 TRACE_EVENT_ASYNC_BEGIN0("cc", "CheckerImageTracker::DeferImageDecode", | 168 TRACE_EVENT_ASYNC_BEGIN0("cc", "CheckerImageTracker::DeferImageDecode", |
167 image_id); | 169 image_id); |
168 image_id_to_decode_request_id_[image_id] = | 170 image_id_to_decode_request_id_[image_id] = |
169 image_controller_->QueueImageDecode( | 171 image_controller_->QueueImageDecode( |
170 outstanding_image_decode_, | 172 outstanding_image_decode_, |
171 base::Bind(&CheckerImageTracker::DidFinishImageDecode, | 173 base::Bind(&CheckerImageTracker::DidFinishImageDecode, |
172 weak_factory_.GetWeakPtr(), image_id)); | 174 weak_factory_.GetWeakPtr(), image_id)); |
173 } | 175 } |
174 | 176 |
175 } // namespace cc | 177 } // namespace cc |
OLD | NEW |