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