Use `inline static constexpr` now that C++17 is supported [chromium/src : main]

675 views
Skip to first unread message

Will Cassella (Gerrit)

unread,
Dec 28, 2021, 2:56:39 PM12/28/21
to Kentaro Hara, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org

Attention is currently required from: Kentaro Hara.

Will Cassella would like Kentaro Hara to review this change.

View Change

Use `inline static constexpr` now that C++17 is supported

Previously, C++ required you to declare "storage" for static constexpr
variables in a compilation unit, similar to other static variables, as
otherwise you would get linker errors. This doesn't really make any
sense for constexpr variables as they're not meant to be modified in any
capacity, and should be inlined wherever they're used. C++17 fixes that
by letting you declare "static inline constexpr" variables, and now that
we've officially adopted C++17 this CL does just that.

Change-Id: Ib84687657d5914d05b7d5417dde767731e138800
---
M third_party/blink/renderer/core/html/media/html_media_element.h
M third_party/blink/renderer/core/html/media/html_media_element.cc
2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc
index 50e9fb1..ec63220 100644
--- a/third_party/blink/renderer/core/html/media/html_media_element.cc
+++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -444,11 +444,6 @@

} // anonymous namespace

-// TODO(https://crbug.com/752720): Remove this once C++17 is adopted (and hence,
-// `inline constexpr` is supported).
-constexpr double HTMLMediaElement::kMinPlaybackRate;
-constexpr double HTMLMediaElement::kMaxPlaybackRate;
-
// static
MIMETypeRegistry::SupportsType HTMLMediaElement::GetSupportsType(
const ContentType& content_type) {
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h
index 9dc34064..3c48056 100644
--- a/third_party/blink/renderer/core/html/media/html_media_element.h
+++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -111,8 +111,8 @@

public:
// Limits the range of media playback rate.
- static constexpr double kMinPlaybackRate = 0.0625;
- static constexpr double kMaxPlaybackRate = 16.0;
+ static inline constexpr double kMinPlaybackRate = 0.0625;
+ static inline constexpr double kMaxPlaybackRate = 16.0;

bool IsMediaElement() const override { return true; }


To view, visit change 3360064. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib84687657d5914d05b7d5417dde767731e138800
Gerrit-Change-Number: 3360064
Gerrit-PatchSet: 1
Gerrit-Owner: Will Cassella <cas...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Will Cassella <cas...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-MessageType: newchange

Will Cassella (Gerrit)

unread,
Dec 28, 2021, 2:56:55 PM12/28/21
to blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, Kentaro Hara, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar

Attention is currently required from: Kentaro Hara.

View Change

1 comment:

  • Patchset:

    • Patch Set #1:

      Hey Kentaro! I though we had more //media owners on this directory, but turns out it's just Dale who's OOO until next year. Would you mind taking a look at this if you're available? Thanks!

To view, visit change 3360064. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib84687657d5914d05b7d5417dde767731e138800
Gerrit-Change-Number: 3360064
Gerrit-PatchSet: 1
Gerrit-Owner: Will Cassella <cas...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Will Cassella <cas...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Dec 2021 19:56:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Avi Drissman (Gerrit)

unread,
Dec 28, 2021, 3:09:38 PM12/28/21
to Will Cassella, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, Avi Drissman, Kentaro Hara, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar

Attention is currently required from: Kentaro Hara, Will Cassella.

Patch set 1:Code-Review -1

View Change

1 comment:

To view, visit change 3360064. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib84687657d5914d05b7d5417dde767731e138800
Gerrit-Change-Number: 3360064
Gerrit-PatchSet: 1
Gerrit-Owner: Will Cassella <cas...@chromium.org>
Gerrit-Reviewer: Avi Drissman <a...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Will Cassella <cas...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-Attention: Will Cassella <cas...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Dec 2021 20:09:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Will Cassella (Gerrit)

unread,
Dec 28, 2021, 4:24:30 PM12/28/21
to blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, Avi Drissman, Kentaro Hara, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar

Attention is currently required from: Kentaro Hara, Avi Drissman.

Patch set 1:Commit-Queue +1

View Change

1 comment:

  • Patchset:

    • Patch Set #1:

      Just because we now support C++17 doesn’t mean you can yet use its new features. […]

      That was fast! 😊
      Sorry, I jumped the gun on this. I've commented on the thread you linked.

To view, visit change 3360064. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib84687657d5914d05b7d5417dde767731e138800
Gerrit-Change-Number: 3360064
Gerrit-PatchSet: 1
Gerrit-Owner: Will Cassella <cas...@chromium.org>
Gerrit-Reviewer: Avi Drissman <a...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Will Cassella <cas...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-Attention: Avi Drissman <a...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Dec 2021 21:24:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Avi Drissman <a...@chromium.org>
Gerrit-MessageType: comment
Reply all
Reply to author
Forward
0 new messages