Bug 211138 - Make PolicyChecker an inner class of FrameLoader
Summary: Make PolicyChecker an inner class of FrameLoader
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-28 11:59 PDT by Rob Buis
Modified: 2020-04-29 06:09 PDT (History)
16 users (show)

See Also:


Attachments
Patch (41.64 KB, patch)
2020-04-28 12:03 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (41.59 KB, patch)
2020-04-28 13:58 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (41.32 KB, patch)
2020-04-28 14:00 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (41.04 KB, patch)
2020-04-29 01:22 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Buis 2020-04-28 11:59:51 PDT
PolicyChecker HistoryController an inner class of FrameLoader, this allows us to move some methods
only used by PolicyChecker out of the FrameLoader public API. Because it is not possible to forward declare
an enum class in an inner class, move ShouldContinue out of the PolicyChecker class and rename it
to ShouldContinuePolicyCheck.
Comment 1 Rob Buis 2020-04-28 12:03:19 PDT
Created attachment 397865 [details]
Patch
Comment 2 Rob Buis 2020-04-28 13:58:35 PDT
Created attachment 397882 [details]
Patch
Comment 3 Rob Buis 2020-04-28 14:00:22 PDT
Created attachment 397883 [details]
Patch
Comment 4 Alex Christensen 2020-04-28 23:00:40 PDT
Comment on attachment 397883 [details]
Patch

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

> Source/WebCore/loader/FrameLoader.h:112
>      PolicyChecker& policyChecker() const { return *m_policyChecker; }

You could make m_policyChecker a UniqueRef

> Source/WebCore/loader/FrameLoaderTypes.h:115
> +enum class ShouldContinuePolicyCheck : uint8_t {

bool

> Source/WebCore/loader/PolicyChecker.h:114
> +template<> struct EnumTraits<WebCore::ShouldContinuePolicyCheck> {

This is not needed if ShouldContinuePolicyCheck has a bool underlying type.
Comment 5 Rob Buis 2020-04-29 01:22:53 PDT
Created attachment 397940 [details]
Patch
Comment 6 EWS 2020-04-29 03:23:06 PDT
Committed r260890: <https://trac.webkit.org/changeset/260890>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397940 [details].
Comment 7 Radar WebKit Bug Importer 2020-04-29 03:24:16 PDT
<rdar://problem/62587616>
Comment 8 Rob Buis 2020-04-29 06:09:30 PDT
Comment on attachment 397883 [details]
Patch

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

>> Source/WebCore/loader/FrameLoader.h:112
>>      PolicyChecker& policyChecker() const { return *m_policyChecker; }
> 
> You could make m_policyChecker a UniqueRef

Is there a clear benefit? I left it out for landing since there are a few similar cases in FrameLoader, I think it is better if needed to fix them all in one patch if there are benefits.

>> Source/WebCore/loader/FrameLoaderTypes.h:115
>> +enum class ShouldContinuePolicyCheck : uint8_t {
> 
> bool

Done.

>> Source/WebCore/loader/PolicyChecker.h:114
>> +template<> struct EnumTraits<WebCore::ShouldContinuePolicyCheck> {
> 
> This is not needed if ShouldContinuePolicyCheck has a bool underlying type.

Nice! I removed it.