Bug 185752

Summary: Lazily create WebCore::Timer for WebCore::Image
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebCore Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, dino, jonlee, koivisto, sabouhallawa, simon.fraser, thorton, webkit-bug-importer, zan
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 185330    
Attachments:
Description Flags
Patch v1 none

David Kilzer (:ddkilzer)
Reported 2018-05-17 15:49:38 PDT
Not every image is an animated image, so lazily creating m_animationStartTimer saves 56 bytes per instance of WebCore::Image.
Attachments
Patch v1 (3.27 KB, patch)
2018-05-17 15:54 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2018-05-17 15:54:03 PDT
Created attachment 340663 [details] Patch v1
Radar WebKit Bug Importer
Comment 2 2018-05-17 16:02:37 PDT
David Kilzer (:ddkilzer)
Comment 3 2018-05-17 16:10:30 PDT
This bug improves the safety of using WebCore::Image in the UI Process since current uses do not include animated images. It also prevents a WebCore::Timer from being allocated for a nullImage.
Simon Fraser (smfr)
Comment 4 2018-05-17 16:20:38 PDT
Comment on attachment 340663 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=340663&action=review > Source/WebCore/platform/graphics/Image.cpp:351 > + std::call_once(onceFlag, [this] { Don't need call_once. Just if (!m_animationStartTimer) > Source/WebCore/platform/graphics/Image.h:203 > + std::once_flag onceFlag; Don't need this here.
David Kilzer (:ddkilzer)
Comment 5 2018-05-17 19:39:28 PDT
Comment on attachment 340663 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=340663&action=review >> Source/WebCore/platform/graphics/Image.cpp:351 >> + std::call_once(onceFlag, [this] { > > Don't need call_once. Just if (!m_animationStartTimer) So we can assume Image::startAnimationAsynchronously() and Image::animationPending() are always called on the main thread? >> Source/WebCore/platform/graphics/Image.h:203 >> + std::once_flag onceFlag; > > Don't need this here. Saves another 8 bytes. WebCore::Image goes down from 104 bytes to just 40 bytes with this change.
David Kilzer (:ddkilzer)
Comment 6 2018-05-17 20:29:43 PDT
Note You need to log in before you can comment on or make changes to this bug.