Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h

Issue 2810423003: Schedule bitmap animation timers on the compositor task runner. (Closed)
Patch Set: fix up comment about a method changed by blink reformat Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebTaskRunner.h"
10 #include "platform/geometry/IntRect.h" 11 #include "platform/geometry/IntRect.h"
11 #include "platform/geometry/IntSizeHash.h" 12 #include "platform/geometry/IntSizeHash.h"
12 #include "platform/geometry/LayoutSize.h" 13 #include "platform/geometry/LayoutSize.h"
13 #include "platform/graphics/Image.h" 14 #include "platform/graphics/Image.h"
14 #include "platform/graphics/ImageObserver.h" 15 #include "platform/graphics/ImageObserver.h"
15 #include "platform/graphics/ImageOrientation.h" 16 #include "platform/graphics/ImageOrientation.h"
16 #include "platform/loader/fetch/ResourceLoadPriority.h" 17 #include "platform/loader/fetch/ResourceLoadPriority.h"
17 #include "platform/loader/fetch/ResourceStatus.h" 18 #include "platform/loader/fetch/ResourceStatus.h"
18 #include "platform/weborigin/KURL.h" 19 #include "platform/weborigin/KURL.h"
19 #include "platform/wtf/AutoReset.h" 20 #include "platform/wtf/AutoReset.h"
(...skipping 20 matching lines...) Expand all
40 // word 'observer' from ImageResource. 41 // word 'observer' from ImageResource.
41 // TODO(hiroshige): Rename local variables of type ImageResourceContent to 42 // TODO(hiroshige): Rename local variables of type ImageResourceContent to
42 // e.g. |imageContent|. Currently they have Resource-like names. 43 // e.g. |imageContent|. Currently they have Resource-like names.
43 class CORE_EXPORT ImageResourceContent final 44 class CORE_EXPORT ImageResourceContent final
44 : public GarbageCollectedFinalized<ImageResourceContent>, 45 : public GarbageCollectedFinalized<ImageResourceContent>,
45 public ImageObserver { 46 public ImageObserver {
46 USING_GARBAGE_COLLECTED_MIXIN(ImageResourceContent); 47 USING_GARBAGE_COLLECTED_MIXIN(ImageResourceContent);
47 48
48 public: 49 public:
49 static ImageResourceContent* Create( 50 static ImageResourceContent* Create(
51 RefPtr<WebTaskRunner> task_runner,
50 PassRefPtr<blink::Image> image = nullptr) { 52 PassRefPtr<blink::Image> image = nullptr) {
51 return new ImageResourceContent(std::move(image)); 53 return new ImageResourceContent(task_runner, std::move(image));
52 } 54 }
53 static ImageResourceContent* Fetch(FetchParameters&, ResourceFetcher*); 55 static ImageResourceContent* Fetch(RefPtr<WebTaskRunner>,
56 FetchParameters&,
57 ResourceFetcher*);
54 58
55 // Returns the nullImage() if the image is not available yet. 59 // Returns the nullImage() if the image is not available yet.
56 blink::Image* GetImage(); 60 blink::Image* GetImage();
57 bool HasImage() const { return image_.Get(); } 61 bool HasImage() const { return image_.Get(); }
58 62
59 static std::pair<blink::Image*, float> BrokenImage( 63 static std::pair<blink::Image*, float> BrokenImage(
60 float 64 float
61 device_scale_factor); // Returns an image and the image's resolution 65 device_scale_factor); // Returns an image and the image's resolution
62 // scale factor. 66 // scale factor.
63 67
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 PassRefPtr<const SharedBuffer> ResourceBuffer() const; 158 PassRefPtr<const SharedBuffer> ResourceBuffer() const;
155 bool ShouldUpdateImageImmediately() const; 159 bool ShouldUpdateImageImmediately() const;
156 bool HasObservers() const { 160 bool HasObservers() const {
157 return !observers_.IsEmpty() || !finished_observers_.IsEmpty(); 161 return !observers_.IsEmpty() || !finished_observers_.IsEmpty();
158 } 162 }
159 bool IsRefetchableDataFromDiskCache() const { 163 bool IsRefetchableDataFromDiskCache() const {
160 return is_refetchable_data_from_disk_cache_; 164 return is_refetchable_data_from_disk_cache_;
161 } 165 }
162 166
163 private: 167 private:
164 explicit ImageResourceContent(PassRefPtr<blink::Image> = nullptr); 168 explicit ImageResourceContent(RefPtr<WebTaskRunner>,
169 PassRefPtr<blink::Image> = nullptr);
165 170
166 // ImageObserver 171 // ImageObserver
167 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override; 172 void DecodedSizeChangedTo(const blink::Image*, size_t new_size) override;
168 bool ShouldPauseAnimation(const blink::Image*) override; 173 bool ShouldPauseAnimation(const blink::Image*) override;
169 void AnimationAdvanced(const blink::Image*) override; 174 void AnimationAdvanced(const blink::Image*) override;
170 void ChangedInRect(const blink::Image*, const IntRect&) override; 175 void ChangedInRect(const blink::Image*, const IntRect&) override;
171 176
172 PassRefPtr<Image> CreateImage(); 177 PassRefPtr<Image> CreateImage();
173 void ClearImage(); 178 void ClearImage();
174 179
(...skipping 21 matching lines...) Expand all
196 201
197 // Indicates if this resource's encoded image data can be purged and refetched 202 // Indicates if this resource's encoded image data can be purged and refetched
198 // from disk cache to save memory usage. See crbug/664437. 203 // from disk cache to save memory usage. See crbug/664437.
199 bool is_refetchable_data_from_disk_cache_; 204 bool is_refetchable_data_from_disk_cache_;
200 205
201 mutable bool is_add_remove_observer_prohibited_ = false; 206 mutable bool is_add_remove_observer_prohibited_ = false;
202 207
203 #if DCHECK_IS_ON() 208 #if DCHECK_IS_ON()
204 bool is_update_image_being_called_ = false; 209 bool is_update_image_being_called_ = false;
205 #endif 210 #endif
211
212 RefPtr<WebTaskRunner> task_runner_;
206 }; 213 };
207 214
208 } // namespace blink 215 } // namespace blink
209 216
210 #endif 217 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698