| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 RespectImageOrientationEnum should_respect_image_orientation, | 86 RespectImageOrientationEnum should_respect_image_orientation, |
| 87 float multiplier, | 87 float multiplier, |
| 88 SizeType = kIntrinsicSize); | 88 SizeType = kIntrinsicSize); |
| 89 | 89 |
| 90 void UpdateImageAnimationPolicy(); | 90 void UpdateImageAnimationPolicy(); |
| 91 | 91 |
| 92 void AddObserver(ImageResourceObserver*); | 92 void AddObserver(ImageResourceObserver*); |
| 93 void RemoveObserver(ImageResourceObserver*); | 93 void RemoveObserver(ImageResourceObserver*); |
| 94 | 94 |
| 95 bool IsSizeAvailable() const { | 95 bool IsSizeAvailable() const { |
| 96 return size_available_ == Image::kSizeAvailable; | 96 return size_available_ != Image::kSizeUnavailable; |
| 97 } | 97 } |
| 98 | 98 |
| 99 DECLARE_TRACE(); | 99 DECLARE_TRACE(); |
| 100 | 100 |
| 101 // Content status and deriving predicates. | 101 // Content status and deriving predicates. |
| 102 // https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVL
r8bE/edit#heading=h.6cyqmir0f30h | 102 // https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVL
r8bE/edit#heading=h.6cyqmir0f30h |
| 103 // Normal transitions: | 103 // Normal transitions: |
| 104 // kNotStarted -> kPending -> kCached|kLoadError|kDecodeError. | 104 // kNotStarted -> kPending -> kCached|kLoadError|kDecodeError. |
| 105 // Additional transitions in multipart images: | 105 // Additional transitions in multipart images: |
| 106 // kCached -> kLoadError|kDecodeError. | 106 // kCached -> kLoadError|kDecodeError. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); | 185 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); |
| 186 | 186 |
| 187 // ImageObserver | 187 // ImageObserver |
| 188 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; | 188 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; |
| 189 bool ShouldPauseAnimation(const blink::Image*) override; | 189 bool ShouldPauseAnimation(const blink::Image*) override; |
| 190 void AnimationAdvanced(const blink::Image*) override; | 190 void AnimationAdvanced(const blink::Image*) override; |
| 191 void ChangedInRect(const blink::Image*, const IntRect&) override; | 191 void ChangedInRect(const blink::Image*, const IntRect&) override; |
| 192 void AsyncLoadCompleted(const blink::Image*) override; |
| 192 | 193 |
| 193 PassRefPtr<Image> CreateImage(); | 194 PassRefPtr<Image> CreateImage(); |
| 194 void ClearImage(); | 195 void ClearImage(); |
| 195 | 196 |
| 196 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; | 197 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; |
| 197 | 198 |
| 198 // If not null, changeRect is the changed part of the image. | 199 // If not null, changeRect is the changed part of the image. |
| 199 void NotifyObservers(NotifyFinishOption, | 200 void NotifyObservers(NotifyFinishOption, |
| 200 const IntRect* change_rect = nullptr); | 201 const IntRect* change_rect = nullptr); |
| 201 void MarkObserverFinished(ImageResourceObserver*); | 202 void MarkObserverFinished(ImageResourceObserver*); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 225 HashCountedSet<ImageResourceObserver*> finished_observers_; | 226 HashCountedSet<ImageResourceObserver*> finished_observers_; |
| 226 | 227 |
| 227 #if DCHECK_IS_ON() | 228 #if DCHECK_IS_ON() |
| 228 bool is_update_image_being_called_ = false; | 229 bool is_update_image_being_called_ = false; |
| 229 #endif | 230 #endif |
| 230 }; | 231 }; |
| 231 | 232 |
| 232 } // namespace blink | 233 } // namespace blink |
| 233 | 234 |
| 234 #endif | 235 #endif |
| OLD | NEW |