Changeset 231940 in webkit
- Timestamp:
- May 17, 2018 8:29:19 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231937 r231940 1 2018-05-17 David Kilzer <ddkilzer@apple.com> 2 3 Lazily create WebCore::Timer for WebCore::Image 4 <https://webkit.org/b/185752> 5 6 Reviewed by Simon Fraser. 7 8 Not every image is an animated image, so lazily creating 9 m_animationStartTimer saves 64 bytes per instance of 10 WebCore::Image. 11 12 * platform/graphics/Image.cpp: 13 (WebCore::Image::Image): Remove default initializer for 14 m_animationStartTimer. 15 (WebCore::Image::startAnimationAsynchronously): Initialize 16 m_animationStartTimer if it's not already created. 17 * platform/graphics/Image.h: 18 (WebCore::Image::animationPending const): Update to check if 19 m_animationStartTimer has been set before dereferencing it. 20 (WebCore::Image::m_animationStartTimer): Change type to 21 std::unique_ptr<Timer>. 22 1 23 2018-05-17 Nan Wang <n_wang@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/Image.cpp
r230350 r231940 51 51 Image::Image(ImageObserver* observer) 52 52 : m_imageObserver(observer) 53 , m_animationStartTimer(*this, &Image::startAnimation)54 53 { 55 54 } … … 350 349 void Image::startAnimationAsynchronously() 351 350 { 352 if (m_animationStartTimer.isActive()) 351 if (!m_animationStartTimer) 352 m_animationStartTimer = std::make_unique<Timer>(*this, &Image::startAnimation); 353 if (m_animationStartTimer->isActive()) 353 354 return; 354 m_animationStartTimer .startOneShot(0_s);355 m_animationStartTimer->startOneShot(0_s); 355 356 } 356 357 -
trunk/Source/WebCore/platform/graphics/Image.h
r230350 r231940 139 139 virtual void resetAnimation() {} 140 140 virtual bool isAnimating() const { return false; } 141 bool animationPending() const { return m_animationStartTimer .isActive(); }141 bool animationPending() const { return m_animationStartTimer && m_animationStartTimer->isActive(); } 142 142 143 143 // Typically the CachedImage that owns us. … … 201 201 RefPtr<SharedBuffer> m_encodedImageData; 202 202 ImageObserver* m_imageObserver; 203 Timerm_animationStartTimer;203 std::unique_ptr<Timer> m_animationStartTimer; 204 204 }; 205 205
Note: See TracChangeset
for help on using the changeset viewer.