RESOLVED FIXED 188314
Add LogArgument template for PlatformMediaSession::RemoteControlCommandType
https://bugs.webkit.org/show_bug.cgi?id=188314
Summary Add LogArgument template for PlatformMediaSession::RemoteControlCommandType
Eric Carlson
Reported 2018-08-03 10:55:38 PDT
Log PlatformMediaSession::RemoteControlCommandType as a readable string.
Attachments
Patch (6.14 KB, patch)
2018-08-03 10:58 PDT, Eric Carlson
achristensen: review-
achristensen: commit-queue-
Patch for landing (9.60 KB, patch)
2018-08-08 10:30 PDT, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2018-08-03 10:58:12 PDT
Eric Carlson
Comment 2 2018-08-03 10:58:27 PDT
Alex Christensen
Comment 3 2018-08-07 11:50:59 PDT
Comment on attachment 346505 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346505&action=review > Source/WebCore/platform/audio/PlatformMediaSession.cpp:102 > + static_assert(static_cast<size_t>(PlatformMediaSession::PlayCommand == 1), "PlatformMediaSession::PlayCommand is not 1 as expected"); Why do you need to convert the booleans into size_t's? > Source/WebCore/platform/audio/PlatformMediaSession.cpp:112 > + ASSERT(static_cast<size_t>(command) < WTF_ARRAY_LENGTH(values)); > + return values[static_cast<size_t>(command)]; I think a switch statement would be more appropriate here. It would allow the compiler to give you an error if you're missing a case if you don't have a default.
Eric Carlson
Comment 4 2018-08-07 13:07:52 PDT
Comment on attachment 346505 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346505&action=review >> Source/WebCore/platform/audio/PlatformMediaSession.cpp:102 >> + static_assert(static_cast<size_t>(PlatformMediaSession::PlayCommand == 1), "PlatformMediaSession::PlayCommand is not 1 as expected"); > > Why do you need to convert the booleans into size_t's? It doesn't convert boolean to size_t, it converts an enum to a size_t so it can be compared to an integer. I just copied the style of the convertEnumerationToString() generated for all enums in IDL. >> Source/WebCore/platform/audio/PlatformMediaSession.cpp:112 >> + return values[static_cast<size_t>(command)]; > > I think a switch statement would be more appropriate here. It would allow the compiler to give you an error if you're missing a case if you don't have a default. Is there a plan to do that for the 250 enums defined in IDL?
Alex Christensen
Comment 5 2018-08-07 13:10:42 PDT
Comment on attachment 346505 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346505&action=review >>> Source/WebCore/platform/audio/PlatformMediaSession.cpp:102 >>> + static_assert(static_cast<size_t>(PlatformMediaSession::PlayCommand == 1), "PlatformMediaSession::PlayCommand is not 1 as expected"); >> >> Why do you need to convert the booleans into size_t's? > > It doesn't convert boolean to size_t, it converts an enum to a size_t so it can be compared to an integer. > > I just copied the style of the convertEnumerationToString() generated for all enums in IDL. I see that now, but you put the parentheses in the wrong place.
Eric Carlson
Comment 6 2018-08-08 10:30:32 PDT
Created attachment 346774 [details] Patch for landing
WebKit Commit Bot
Comment 7 2018-08-08 11:11:06 PDT
Comment on attachment 346774 [details] Patch for landing Clearing flags on attachment: 346774 Committed r234703: <https://trac.webkit.org/changeset/234703>
WebKit Commit Bot
Comment 8 2018-08-08 11:11:07 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.