WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 220529
Reimplement WebCore::isInWebProcess() family as cross-platform by using AuxiliaryProcessInitializationParameters.processType
https://bugs.webkit.org/show_bug.cgi?id=220529
Summary
Reimplement WebCore::isInWebProcess() family as cross-platform by using Auxil...
Fujii Hironori
Reported
2021-01-11 18:48:34 PST
Reimplement WebCore::isInWebProcess() families as cross-platform by using AuxiliaryProcessInitializationParameters.processType I'm going to reimplement the following functions. WebCore::isInWebProcess() WebCore::isInGPUProcess() WebCore::isInNetworkProcess()
Attachments
WIP patch
(15.45 KB, patch)
2021-01-11 18:49 PST
,
Fujii Hironori
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
WIP patch
(15.68 KB, patch)
2021-01-11 19:04 PST
,
Fujii Hironori
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(19.49 KB, patch)
2021-01-11 19:54 PST
,
Fujii Hironori
don.olmstead
: review+
achristensen
: commit-queue-
Details
Formatted Diff
Diff
Patch
(27.69 KB, patch)
2021-01-12 13:45 PST
,
Fujii Hironori
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(27.76 KB, patch)
2021-01-12 13:50 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(27.83 KB, patch)
2021-01-12 16:31 PST
,
Fujii Hironori
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.89 KB, patch)
2021-01-12 16:50 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(20.88 KB, patch)
2021-01-12 17:18 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch for landing
(20.83 KB, patch)
2021-01-13 12:30 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2021-01-11 18:49:18 PST
Created
attachment 417425
[details]
WIP patch
Fujii Hironori
Comment 2
2021-01-11 19:04:19 PST
Created
attachment 417426
[details]
WIP patch
Fujii Hironori
Comment 3
2021-01-11 19:54:41 PST
Created
attachment 417428
[details]
Patch
Alex Christensen
Comment 4
2021-01-12 11:33:42 PST
Comment on
attachment 417428
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417428&action=review
> Source/WebCore/platform/RuntimeApplicationChecks.cpp:63 > +static ProcessType s_processType = ProcessType::Invalid;
static Optional<AuxiliaryProcessType> auxiliaryProcessType;
> Source/WebCore/platform/RuntimeApplicationChecks.h:35 > +enum class ProcessType : uint8_t {
AuxiliaryProcessType. Remove Invalid.
> Source/WebKit/Shared/AuxiliaryProcess.h:48 > enum class ProcessType : uint8_t {
Let's remove this duplicate enum.
Fujii Hironori
Comment 5
2021-01-12 13:26:14 PST
Comment on
attachment 417428
[details]
Patch Thank you for the review. I will revise the patch.
Fujii Hironori
Comment 6
2021-01-12 13:45:40 PST
Created
attachment 417488
[details]
Patch
Fujii Hironori
Comment 7
2021-01-12 13:50:07 PST
Created
attachment 417489
[details]
Patch
Alex Christensen
Comment 8
2021-01-12 13:53:28 PST
Comment on
attachment 417489
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417489&action=review
> Source/WebCore/platform/RuntimeApplicationChecks.cpp:70 > +Optional<AuxiliaryProcessType> auxiliaryProcessType()
If this returns a const Optional<AuxiliaryProcessType>& you can have a function scoped static variable instead of using possibly uninitialized memory if you call checkAuxiliaryProcessType from the UI process.
Fujii Hironori
Comment 9
2021-01-12 16:18:01 PST
Comment on
attachment 417489
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417489&action=review
>> Source/WebCore/platform/RuntimeApplicationChecks.cpp:70 >> +Optional<AuxiliaryProcessType> auxiliaryProcessType() > > If this returns a const Optional<AuxiliaryProcessType>& you can have a function scoped static variable instead of using possibly uninitialized memory if you call checkAuxiliaryProcessType from the UI process.
It isn't uninitialized memory. And, becasue Optional has a constexpr ctor, I think ctor isn't executed at runtime. Here is the function-scope version. const Optional<AuxiliaryProcessType>& auxiliaryProcessType() { static AuxiliaryProcessType s_auxiliaryProcessType; return s_auxiliaryProcessType; } I think there is no difference. Returning Optional<AuxiliaryProcessType>& requires dereferencing in caller side. Returning Optional<AuxiliaryProcessType> requires dereferencing in callee side. I didn't check disassemble code, but I expect returning Optional<AuxiliaryProcessType> is slightly efficient.
Fujii Hironori
Comment 10
2021-01-12 16:27:41 PST
Comment on
attachment 417489
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417489&action=review
> Source/WebCore/platform/RuntimeApplicationChecks.cpp:63 > +static AuxiliaryProcessType s_auxiliaryProcessType;
Oops. I fotgot to replace the type. I got your idea. It's uninitialized.
Fujii Hironori
Comment 11
2021-01-12 16:31:01 PST
Created
attachment 417496
[details]
Patch
Fujii Hironori
Comment 12
2021-01-12 16:50:24 PST
Created
attachment 417497
[details]
Patch
Chris Dumez
Comment 13
2021-01-12 16:59:13 PST
Comment on
attachment 417497
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417497&action=review
> Source/WebCore/platform/RuntimeApplicationChecks.cpp:65 > + static Optional<AuxiliaryProcessType> s_auxiliaryProcessType;
I don't think we use prefixes for such static variables usually.
> Source/WebKit/Shared/AuxiliaryProcessMain.h:45 > + AuxiliaryProcessInitializationParameters& m_parameters;
While this may currently be safe (I have not look deeply enough to verify), this looks dangerous and I wish we did not introduce such a fragile design that could very easily lead to use-after-free.
Fujii Hironori
Comment 14
2021-01-12 17:14:34 PST
Comment on
attachment 417497
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417497&action=review
>> Source/WebCore/platform/RuntimeApplicationChecks.cpp:65 >> + static Optional<AuxiliaryProcessType> s_auxiliaryProcessType; > > I don't think we use prefixes for such static variables usually.
Will fix.
>> Source/WebKit/Shared/AuxiliaryProcessMain.h:45 >> + AuxiliaryProcessInitializationParameters& m_parameters; > > While this may currently be safe (I have not look deeply enough to verify), this looks dangerous and I wish we did not introduce such a fragile design that could very easily lead to use-after-free.
I agree. I will change the patch look more sane. I will redesign AuxiliaryProcessMain in another bug ticket later. BTW, it is non-cocoa code.
Fujii Hironori
Comment 15
2021-01-12 17:18:55 PST
Created
attachment 417501
[details]
Patch
Alex Christensen
Comment 16
2021-01-13 08:28:40 PST
Comment on
attachment 417501
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417501&action=review
> Source/WebCore/platform/RuntimeApplicationChecks.h:29 > +#include <wtf/Optional.h>
I don't think this is needed.
Fujii Hironori
Comment 17
2021-01-13 12:30:05 PST
Created
attachment 417552
[details]
Patch for landing
Fujii Hironori
Comment 18
2021-01-13 12:42:16 PST
Comment on
attachment 417501
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417501&action=review
>> Source/WebCore/platform/RuntimeApplicationChecks.h:29 >> +#include <wtf/Optional.h> > > I don't think this is needed.
Fixed. Thank you.
EWS
Comment 19
2021-01-13 13:05:40 PST
Committed
r271452
: <
https://trac.webkit.org/changeset/271452
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 417552
[details]
.
Radar WebKit Bug Importer
Comment 20
2021-01-13 13:06:16 PST
<
rdar://problem/73163290
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug