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.
Created attachment 386680 [details]
Comment on attachment 386680 [details]
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.
Created attachment 386859 [details]
Comment on attachment 386859 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=386859&action=review
> + (void) endTime; // Only used for logs, we need this to avoid "unused variable" errors in Release.
Even better solution:
MediaTime endTime = PAL::toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
Created attachment 386963 [details]
Created attachment 386973 [details]
Comment on attachment 386973 [details]
Clearing flags on attachment: 386973
Committed r254200: <https://trac.webkit.org/changeset/254200>
All reviewed patches have been landed. Closing bug.