Bug 205723

Summary: [WTF] Allow MediaTime static constants
Product: WebKit Reporter: Alicia Boya García <aboya>
Component: Web Template FrameworkAssignee: Alicia Boya García <aboya>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, calvaris, cdumez, cmarcelo, commit-queue, darin, dbates, eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=235610
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Alicia Boya García
Reported 2020-01-03 06:58:41 PST
Despite all its convenience methods, at its core MediaTime is a rather trivial class with only integral members. Despite this, since it had a destructor declared, this made the class non-trivially destructible even if the implementation was empty, and therefore clang did not allow to use it for static variables unless done in form of a pointer. By removing the destructor this restriction is lifted and we don't need heap allocations for static MediaTime objects. Previous usages of heap allocation for static MediaTime objects have been rewritten to take advantage of this. Test coverage is provided by successful compilation without [-Werror,-Wexit-time-destructors] errors and existing tests.
Attachments
Patch (4.22 KB, patch)
2020-01-03 07:02 PST, Alicia Boya García
no flags
Patch (6.39 KB, patch)
2020-01-06 10:12 PST, Alicia Boya García
no flags
Patch (7.41 KB, patch)
2020-01-07 06:13 PST, Alicia Boya García
no flags
Patch (8.00 KB, patch)
2020-01-07 08:00 PST, Alicia Boya García
no flags
Alicia Boya García
Comment 1 2020-01-03 07:02:37 PST
Darin Adler
Comment 2 2020-01-03 19:40:25 PST
Comment on attachment 386680 [details] Patch Great change! Looks like getting rid of the destructor helped the compiler notice quite a few unused MediaTime variables so need to fix those too. Also seems like this points to the direction where we could make this class compatible with constexpr so more of it could be evaluated at compile time.
Alicia Boya García
Comment 3 2020-01-06 10:12:22 PST
Darin Adler
Comment 4 2020-01-06 13:26:13 PST
Comment on attachment 386859 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386859&action=review > Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm:478 > + (void) endTime; // Only used for logs, we need this to avoid "unused variable" errors in Release. Even better solution: #if !LOG_DISABLED MediaTime endTime = PAL::toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get())); #endif
Alicia Boya García
Comment 5 2020-01-07 06:13:15 PST
Alicia Boya García
Comment 6 2020-01-07 08:00:43 PST
WebKit Commit Bot
Comment 7 2020-01-08 07:57:10 PST
Comment on attachment 386973 [details] Patch Clearing flags on attachment: 386973 Committed r254200: <https://trac.webkit.org/changeset/254200>
WebKit Commit Bot
Comment 8 2020-01-08 07:57:12 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2020-01-08 07:58:14 PST
Note You need to log in before you can comment on or make changes to this bug.