| 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 <memory> | 8 #include <memory> |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "platform/geometry/IntRect.h" | 10 #include "platform/geometry/IntRect.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 enum class UpdateImageResult { | 156 enum class UpdateImageResult { |
| 157 kNoDecodeError, | 157 kNoDecodeError, |
| 158 | 158 |
| 159 // Decode error occurred. Observers are not notified. | 159 // Decode error occurred. Observers are not notified. |
| 160 // Only occurs when UpdateImage or ClearAndUpdateImage is specified. | 160 // Only occurs when UpdateImage or ClearAndUpdateImage is specified. |
| 161 kShouldDecodeError, | 161 kShouldDecodeError, |
| 162 }; | 162 }; |
| 163 WARN_UNUSED_RESULT UpdateImageResult UpdateImage(PassRefPtr<SharedBuffer>, | 163 WARN_UNUSED_RESULT UpdateImageResult UpdateImage(PassRefPtr<SharedBuffer>, |
| 164 ResourceStatus, | 164 ResourceStatus, |
| 165 UpdateImageOption, | 165 UpdateImageOption, |
| 166 bool all_data_received); | 166 bool all_data_received, |
| 167 bool is_multipart); |
| 167 | 168 |
| 168 void NotifyStartLoad(); | 169 void NotifyStartLoad(); |
| 169 void DestroyDecodedData(); | 170 void DestroyDecodedData(); |
| 170 void DoResetAnimation(); | 171 void DoResetAnimation(); |
| 171 | 172 |
| 172 void SetImageResourceInfo(ImageResourceInfo*); | 173 void SetImageResourceInfo(ImageResourceInfo*); |
| 173 | 174 |
| 174 ResourcePriority PriorityFromObservers() const; | 175 ResourcePriority PriorityFromObservers() const; |
| 175 PassRefPtr<const SharedBuffer> ResourceBuffer() const; | 176 PassRefPtr<const SharedBuffer> ResourceBuffer() const; |
| 176 bool ShouldUpdateImageImmediately() const; | 177 bool ShouldUpdateImageImmediately() const; |
| 177 bool HasObservers() const { | 178 bool HasObservers() const { |
| 178 return !observers_.IsEmpty() || !finished_observers_.IsEmpty(); | 179 return !observers_.IsEmpty() || !finished_observers_.IsEmpty(); |
| 179 } | 180 } |
| 180 bool IsRefetchableDataFromDiskCache() const { | 181 bool IsRefetchableDataFromDiskCache() const { |
| 181 return is_refetchable_data_from_disk_cache_; | 182 return is_refetchable_data_from_disk_cache_; |
| 182 } | 183 } |
| 183 | 184 |
| 184 private: | 185 private: |
| 185 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); | 186 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); |
| 186 | 187 |
| 187 // ImageObserver | 188 // ImageObserver |
| 188 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; | 189 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; |
| 189 bool ShouldPauseAnimation(const blink::Image*) override; | 190 bool ShouldPauseAnimation(const blink::Image*) override; |
| 190 void AnimationAdvanced(const blink::Image*) override; | 191 void AnimationAdvanced(const blink::Image*) override; |
| 191 void ChangedInRect(const blink::Image*, const IntRect&) override; | 192 void ChangedInRect(const blink::Image*, const IntRect&) override; |
| 192 void AsyncLoadCompleted(const blink::Image*) override; | 193 void AsyncLoadCompleted(const blink::Image*) override; |
| 193 | 194 |
| 194 PassRefPtr<Image> CreateImage(); | 195 PassRefPtr<Image> CreateImage(bool is_multipart); |
| 195 void ClearImage(); | 196 void ClearImage(); |
| 196 | 197 |
| 197 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; | 198 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; |
| 198 | 199 |
| 199 // If not null, changeRect is the changed part of the image. | 200 // If not null, changeRect is the changed part of the image. |
| 200 void NotifyObservers(NotifyFinishOption, | 201 void NotifyObservers(NotifyFinishOption, |
| 201 const IntRect* change_rect = nullptr); | 202 const IntRect* change_rect = nullptr); |
| 202 void MarkObserverFinished(ImageResourceObserver*); | 203 void MarkObserverFinished(ImageResourceObserver*); |
| 203 void UpdateToLoadedContentStatus(ResourceStatus); | 204 void UpdateToLoadedContentStatus(ResourceStatus); |
| 204 | 205 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 226 HashCountedSet<ImageResourceObserver*> finished_observers_; | 227 HashCountedSet<ImageResourceObserver*> finished_observers_; |
| 227 | 228 |
| 228 #if DCHECK_IS_ON() | 229 #if DCHECK_IS_ON() |
| 229 bool is_update_image_being_called_ = false; | 230 bool is_update_image_being_called_ = false; |
| 230 #endif | 231 #endif |
| 231 }; | 232 }; |
| 232 | 233 |
| 233 } // namespace blink | 234 } // namespace blink |
| 234 | 235 |
| 235 #endif | 236 #endif |
| OLD | NEW |