Bug 178321 - [Settings] Split non-macro generated parts of Settings into SettingsBase base class
Summary: [Settings] Split non-macro generated parts of Settings into SettingsBase base...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-15 12:36 PDT by Sam Weinig
Modified: 2017-10-15 19:59 PDT (History)
5 users (show)

See Also:


Attachments
Patch (148.22 KB, patch)
2017-10-15 12:39 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (148.90 KB, patch)
2017-10-15 19:13 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-10-15 12:36:26 PDT
[Settings] Split non-macro generated parts of Settings into SettingsBase base class
Comment 1 Sam Weinig 2017-10-15 12:39:31 PDT
Created attachment 323847 [details]
Patch
Comment 2 Build Bot 2017-10-15 12:42:18 PDT
Attachment 323847 [details] did not pass style-queue:


ERROR: Source/WebCore/page/SettingsBase.h:140:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
ERROR: Source/WebCore/page/SettingsBase.h:190:  The parameter name "mode" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/page/SettingsBase.cpp:314:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
ERROR: Source/WebCore/page/SettingsBase.cpp:417:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/page/SettingsBase.cpp:455:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 5 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2017-10-15 17:38:54 PDT
Comment on attachment 323847 [details]
Patch

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

> Source/WebCore/page/SettingsBase.cpp:144
> +SettingsBase::SettingsBase(Page* page)

Take a reference to a page?

> Source/WebCore/page/SettingsBase.cpp:145
>      : m_page(nullptr)

Initialize in class definition instead of here?

> Source/WebCore/page/SettingsBase.cpp:146
>      , m_mediaTypeOverride("screen")

Initialize in class definition instead of here?

> Source/WebCore/page/SettingsBase.cpp:148
>      , m_storageBlockingPolicy(SecurityOrigin::AllowAllStorage)

Initialize in class definition instead of here?

> Source/WebCore/page/SettingsBase.cpp:168
>      , m_timeWithoutMouseMovementBeforeHidingControls(3_s)

Initialize in class definition instead of here?

> Source/WebCore/page/SettingsBase.h:102
> +    ~SettingsBase();

I’d think this would need to be virtual, or the reference counting would need to be in the derived class, not the base. Or some other trick to make sure we call ~Settings when we do the last deref.
Comment 4 Sam Weinig 2017-10-15 18:59:49 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 323847 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=323847&action=review
> 
> > Source/WebCore/page/SettingsBase.cpp:144
> > +SettingsBase::SettingsBase(Page* page)
> 
> Take a reference to a page?

Alas, we can't, there is caller who passes nullptr in Document for frameless Documents.

> 
> > Source/WebCore/page/SettingsBase.cpp:145
> >      : m_page(nullptr)
> 
> Initialize in class definition instead of here?

Yup, will fix all of these.


> > Source/WebCore/page/SettingsBase.h:102
> > +    ~SettingsBase();
> 
> I’d think this would need to be virtual, or the reference counting would
> need to be in the derived class, not the base. Or some other trick to make
> sure we call ~Settings when we do the last deref.

I'm going to move the RefCounted back to Settings.
Comment 5 Sam Weinig 2017-10-15 19:13:42 PDT
Created attachment 323855 [details]
Patch
Comment 6 Build Bot 2017-10-15 19:16:06 PDT
Attachment 323855 [details] did not pass style-queue:


ERROR: Source/WebCore/page/SettingsBase.h:140:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
ERROR: Source/WebCore/page/SettingsBase.h:190:  The parameter name "mode" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/page/SettingsBase.cpp:311:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
ERROR: Source/WebCore/page/SettingsBase.cpp:414:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/page/SettingsBase.cpp:452:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 5 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 WebKit Commit Bot 2017-10-15 19:59:11 PDT
Comment on attachment 323855 [details]
Patch

Clearing flags on attachment: 323855

Committed r223332: <https://trac.webkit.org/changeset/223332>
Comment 8 WebKit Commit Bot 2017-10-15 19:59:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2017-10-15 19:59:41 PDT
<rdar://problem/35000638>