[webkit-reviews] review granted: [Bug 188554] Use OptionSet for ActivityState::Flags : [Attachment 347081] patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Aug 14 09:30:51 PDT 2018
Brent Fulgham <bfulgham at webkit.org> has granted Antti Koivisto
<koivisto at iki.fi>'s request for review:
Bug 188554: Use OptionSet for ActivityState::Flags
https://bugs.webkit.org/show_bug.cgi?id=188554
Attachment 347081: patch
https://bugs.webkit.org/attachment.cgi?id=347081&action=review
--- Comment #2 from Brent Fulgham <bfulgham at webkit.org> ---
Comment on attachment 347081
--> https://bugs.webkit.org/attachment.cgi?id=347081
patch
View in context: https://bugs.webkit.org/attachment.cgi?id=347081&action=review
Looks good! r=me
> Source/WebCore/page/ActivityState.cpp:54
> + appendIf(ActivityState::IsCapturingMedia, "capturing media");
Nice cleanup!
> Source/WebCore/page/FocusController.cpp:356
> + m_page.setActivityState(focused ? m_activityState |
ActivityState::IsFocused : m_activityState - ActivityState::IsFocused);
It's too bad we still have to use all of this bitwise math for an OptionSet. It
would be much clearer to say something like
"m_activityState.remove(ActivityState::IsFocused)
> Source/WebCore/page/Page.cpp:1652
> + state -= { ActivityState::IsVisible,
ActivityState::IsVisibleOrOccluded };
Again, these bitwise operators are hard to reason about when reading the code.
Seems like extending OptionSet with helpful methods would make these kinds of
statements easier to understand.
More information about the webkit-reviews
mailing list