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 // Normal transitions: | 97 // Normal transitions: |
98 // kNotStarted -> kPending -> kCached|kLoadError|kDecodeError. | 98 // kNotStarted -> kPending -> kCached|kLoadError|kDecodeError. |
99 // Additional transitions in multipart images: | 99 // Additional transitions in multipart images: |
100 // kCached -> kLoadError|kDecodeError. | 100 // kCached -> kLoadError|kDecodeError. |
101 // Transitions due to revalidation: | 101 // Transitions due to revalidation: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 private: | 178 private: |
179 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); | 179 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); |
180 | 180 |
181 // ImageObserver | 181 // ImageObserver |
182 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; | 182 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; |
183 bool ShouldPauseAnimation(const blink::Image*) override; | 183 bool ShouldPauseAnimation(const blink::Image*) override; |
184 void AnimationAdvanced(const blink::Image*) override; | 184 void AnimationAdvanced(const blink::Image*) override; |
185 void ChangedInRect(const blink::Image*, const IntRect&) override; | 185 void ChangedInRect(const blink::Image*, const IntRect&) override; |
| 186 void AsyncLoadCompleted(const blink::Image*) override; |
186 | 187 |
187 PassRefPtr<Image> CreateImage(); | 188 PassRefPtr<Image> CreateImage(); |
188 void ClearImage(); | 189 void ClearImage(); |
189 | 190 |
190 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; | 191 enum NotifyFinishOption { kShouldNotifyFinish, kDoNotNotifyFinish }; |
191 | 192 |
192 // If not null, changeRect is the changed part of the image. | 193 // If not null, changeRect is the changed part of the image. |
193 void NotifyObservers(NotifyFinishOption, | 194 void NotifyObservers(NotifyFinishOption, |
194 const IntRect* change_rect = nullptr); | 195 const IntRect* change_rect = nullptr); |
195 void MarkObserverFinished(ImageResourceObserver*); | 196 void MarkObserverFinished(ImageResourceObserver*); |
(...skipping 22 matching lines...) Expand all Loading... |
218 mutable bool is_add_remove_observer_prohibited_ = false; | 219 mutable bool is_add_remove_observer_prohibited_ = false; |
219 | 220 |
220 #if DCHECK_IS_ON() | 221 #if DCHECK_IS_ON() |
221 bool is_update_image_being_called_ = false; | 222 bool is_update_image_being_called_ = false; |
222 #endif | 223 #endif |
223 }; | 224 }; |
224 | 225 |
225 } // namespace blink | 226 } // namespace blink |
226 | 227 |
227 #endif | 228 #endif |
OLD | NEW |