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 #ifndef ImageResourceContent_h | 5 #ifndef ImageResourceContent_h |
6 #define ImageResourceContent_h | 6 #define ImageResourceContent_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/geometry/IntRect.h" | 9 #include "platform/geometry/IntRect.h" |
10 #include "platform/geometry/IntSizeHash.h" | 10 #include "platform/geometry/IntSizeHash.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Updates the image (including placeholder and decode error handling | 125 // Updates the image (including placeholder and decode error handling |
126 // and notifying observers) if needed. | 126 // and notifying observers) if needed. |
127 UpdateImage, | 127 UpdateImage, |
128 | 128 |
129 // Clears the image and then updates the image if needed. | 129 // Clears the image and then updates the image if needed. |
130 ClearAndUpdateImage, | 130 ClearAndUpdateImage, |
131 | 131 |
132 // Clears the image and always notifies observers (without updating). | 132 // Clears the image and always notifies observers (without updating). |
133 ClearImageAndNotifyObservers, | 133 ClearImageAndNotifyObservers, |
134 }; | 134 }; |
135 void updateImage(PassRefPtr<SharedBuffer>, | 135 enum class UpdateImageResult { |
136 UpdateImageOption, | 136 NoDecodeError, |
137 bool allDataReceived); | 137 |
| 138 // Decode error occurred. Observers are not notified. |
| 139 // Only occurs when UpdateImage or ClearAndUpdateImage is specified. |
| 140 ShouldDecodeError, |
| 141 }; |
| 142 WARN_UNUSED_RESULT UpdateImageResult updateImage(PassRefPtr<SharedBuffer>, |
| 143 UpdateImageOption, |
| 144 bool allDataReceived); |
138 | 145 |
139 void destroyDecodedData(); | 146 void destroyDecodedData(); |
140 void doResetAnimation(); | 147 void doResetAnimation(); |
141 | 148 |
142 void setImageResourceInfo(ImageResourceInfo*); | 149 void setImageResourceInfo(ImageResourceInfo*); |
143 | 150 |
144 ResourcePriority priorityFromObservers() const; | 151 ResourcePriority priorityFromObservers() const; |
145 PassRefPtr<const SharedBuffer> resourceBuffer() const; | 152 PassRefPtr<const SharedBuffer> resourceBuffer() const; |
146 bool shouldUpdateImageImmediately() const; | 153 bool shouldUpdateImageImmediately() const; |
147 bool hasObservers() const { | 154 bool hasObservers() const { |
(...skipping 26 matching lines...) Expand all Loading... |
174 RefPtr<blink::Image> m_image; | 181 RefPtr<blink::Image> m_image; |
175 | 182 |
176 HashCountedSet<ImageResourceObserver*> m_observers; | 183 HashCountedSet<ImageResourceObserver*> m_observers; |
177 HashCountedSet<ImageResourceObserver*> m_finishedObservers; | 184 HashCountedSet<ImageResourceObserver*> m_finishedObservers; |
178 | 185 |
179 Image::SizeAvailability m_sizeAvailable = Image::SizeUnavailable; | 186 Image::SizeAvailability m_sizeAvailable = Image::SizeUnavailable; |
180 | 187 |
181 // Indicates if this resource's encoded image data can be purged and refetched | 188 // Indicates if this resource's encoded image data can be purged and refetched |
182 // from disk cache to save memory usage. See crbug/664437. | 189 // from disk cache to save memory usage. See crbug/664437. |
183 bool m_isRefetchableDataFromDiskCache; | 190 bool m_isRefetchableDataFromDiskCache; |
| 191 |
| 192 #if DCHECK_IS_ON() |
| 193 bool m_isUpdateImageBeingCalled = false; |
| 194 #endif |
184 }; | 195 }; |
185 | 196 |
186 } // namespace blink | 197 } // namespace blink |
187 | 198 |
188 #endif | 199 #endif |
OLD | NEW |