OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // Overridden from Task: | 142 // Overridden from Task: |
143 void RunOnWorkerThread() override { | 143 void RunOnWorkerThread() override { |
144 TRACE_EVENT0("cc", "ImageDecodeTaskImpl::RunOnWorkerThread"); | 144 TRACE_EVENT0("cc", "ImageDecodeTaskImpl::RunOnWorkerThread"); |
145 | 145 |
146 devtools_instrumentation::ScopedImageDecodeTask image_decode_task( | 146 devtools_instrumentation::ScopedImageDecodeTask image_decode_task( |
147 pixel_ref_.get()); | 147 pixel_ref_.get()); |
148 // This will cause the image referred to by pixel ref to be decoded. | 148 // This will cause the image referred to by pixel ref to be decoded. |
149 pixel_ref_->lockPixels(); | 149 pixel_ref_->lockPixels(); |
150 pixel_ref_->unlockPixels(); | 150 pixel_ref_->unlockPixels(); |
| 151 |
| 152 // Release the reference after decoding image to ensure that it is not |
| 153 // kept alive unless needed. |
| 154 pixel_ref_.clear(); |
151 } | 155 } |
152 | 156 |
153 // Overridden from TileTask: | 157 // Overridden from TileTask: |
154 void ScheduleOnOriginThread(TileTaskClient* client) override {} | 158 void ScheduleOnOriginThread(TileTaskClient* client) override {} |
155 void CompleteOnOriginThread(TileTaskClient* client) override {} | 159 void CompleteOnOriginThread(TileTaskClient* client) override {} |
156 void RunReplyOnOriginThread() override { reply_.Run(!HasFinishedRunning()); } | 160 void RunReplyOnOriginThread() override { reply_.Run(!HasFinishedRunning()); } |
157 | 161 |
158 protected: | 162 protected: |
159 ~ImageDecodeTaskImpl() override {} | 163 ~ImageDecodeTaskImpl() override {} |
160 | 164 |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 result -= other; | 1052 result -= other; |
1049 return result; | 1053 return result; |
1050 } | 1054 } |
1051 | 1055 |
1052 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1056 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1053 return memory_bytes_ > limit.memory_bytes_ || | 1057 return memory_bytes_ > limit.memory_bytes_ || |
1054 resource_count_ > limit.resource_count_; | 1058 resource_count_ > limit.resource_count_; |
1055 } | 1059 } |
1056 | 1060 |
1057 } // namespace cc | 1061 } // namespace cc |
OLD | NEW |