Bug 212758 - [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy
Summary: [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks: 211988
  Show dependency treegraph
 
Reported: 2020-06-04 10:09 PDT by David Kilzer (:ddkilzer)
Modified: 2020-06-11 13:38 PDT (History)
6 users (show)

See Also:


Attachments
Patch v1 (18.77 KB, patch)
2020-06-04 11:44 PDT, David Kilzer (:ddkilzer)
darin: review+
Details | Formatted Diff | Diff
Patch for landing (18.18 KB, patch)
2020-06-04 17:59 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-06-04 10:09:08 PDT
Adopt EnumTraits and enum class for PluginProcessType and PluginProcessSandboxPolicy.
Comment 1 David Kilzer (:ddkilzer) 2020-06-04 11:44:10 PDT
Created attachment 401057 [details]
Patch v1
Comment 2 Darin Adler 2020-06-04 11:46:15 PDT
Comment on attachment 401057 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=401057&action=review

> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:33
> +enum class PluginProcessType : uint8_t {

How did you choose uint8_t vs. bool for this?

> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:38
> +enum class PluginProcessSandboxPolicy : uint8_t {

Ditto.
Comment 3 David Kilzer (:ddkilzer) 2020-06-04 11:50:23 PDT
Comment on attachment 401057 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=401057&action=review

>> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:33
>> +enum class PluginProcessType : uint8_t {
> 
> How did you choose uint8_t vs. bool for this?

This didn't seen like a `bool` concept, but maybe I should be thinking in terms of storage size, not whether it's a Boolean concept.  I can change it if you prefer.

>> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:38
>> +enum class PluginProcessSandboxPolicy : uint8_t {
> 
> Ditto.

Ditto.
Comment 4 Alex Christensen 2020-06-04 13:12:07 PDT
Comment on attachment 401057 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=401057&action=review

>>> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:38
>>> +enum class PluginProcessSandboxPolicy : uint8_t {
>> 
>> Ditto.
> 
> Ditto.

If you use a boolean for storage, you don't need EnumTraits, because IPC knows there are only two valid values.
Comment 5 David Kilzer (:ddkilzer) 2020-06-04 13:23:21 PDT
(In reply to Alex Christensen from comment #4)
> Comment on attachment 401057 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=401057&action=review
> 
> >>> Source/WebKit/Shared/Plugins/PluginProcessAttributes.h:38
> >>> +enum class PluginProcessSandboxPolicy : uint8_t {
> >> 
> >> Ditto.
> > 
> > Ditto.
> 
> If you use a boolean for storage, you don't need EnumTraits, because IPC
> knows there are only two valid values.

I'm curious whether IPC checks for 0x0 and 0x1, or just 0x0 and any value with any bit set.  The latter seems less desirable to me if that's how it's implemented.  (I'm not sure where to look for the implementation off the top of my head.)
Comment 6 Alex Christensen 2020-06-04 13:34:06 PDT
This is the implementation:
return !t || t == 1;
Comment 7 David Kilzer (:ddkilzer) 2020-06-04 17:50:26 PDT
(In reply to Alex Christensen from comment #6)
> This is the implementation:
> return !t || t == 1;

Thanks!  I remembered after I posted the last comment that this was a change to Source/WTF/wtf/EnumTraits.h in Bug 190731.
Comment 8 David Kilzer (:ddkilzer) 2020-06-04 17:59:58 PDT
Created attachment 401105 [details]
Patch for landing
Comment 9 David Kilzer (:ddkilzer) 2020-06-04 22:30:44 PDT
Comment on attachment 401105 [details]
Patch for landing

Marking cq+ since all bots are green except JSC, but there are no changes affecting JSC in this patch.
Comment 10 EWS 2020-06-04 22:36:37 PDT
Committed r262598: <https://trac.webkit.org/changeset/262598>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401105 [details].
Comment 11 David Kilzer (:ddkilzer) 2020-06-05 08:04:35 PDT
<rdar://problem/64029049>