[Webkit-unassigned] [Bug 206036] New: [WTF] Make MediaTime constructor constexpr
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jan 9 14:13:36 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=206036
Bug ID: 206036
Summary: [WTF] Make MediaTime constructor constexpr
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Web Template Framework
Assignee: webkit-unassigned at lists.webkit.org
Reporter: aboya at igalia.com
https://bugs.webkit.org/show_bug.cgi?id=205723 allowed to declare
MediaTime variables as static inside functions without needing a
global destructor.
It did not eliminate the call to the MediaTime constructor on runtime
though. This wasn't a problem for static variables inside functions,
as the compiler adds a guard variable to call the constructor the
first time the function is called.
On the other hand, for variables defined outside of the scope of the
function, for them to be initialized the MediaTime constructor would
have to be called at runtime from a global constructor, something
we're trying to avoid and which generates an error in clang.
But again, MediaTime is a simple class with only integral values, we
shouldn't need a runtime function call to initialize it!
This patch makes the MediaTime constructor constexpr so that we don't
need runtime initialization for static MediaTime variables. This
allows us to declare them outside functions and enables the compiler
to generate code without guard variables when static MediaTime
variables are declared inside functions.
A test has been added accessing a global const static MediaTime. The
build should not produce any error stating the need for a global
constructor.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200109/3bab9c58/attachment-0001.htm>
More information about the webkit-unassigned
mailing list