Bug 147811 - Replace WebPageConfiguration with API::PageConfiguration and expose a C-SPI accessor for it
Summary: Replace WebPageConfiguration with API::PageConfiguration and expose a C-SPI a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-08 13:59 PDT by Sam Weinig
Modified: 2015-08-27 01:47 PDT (History)
2 users (show)

See Also:


Attachments
Patch (41.43 KB, patch)
2015-08-08 14:06 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (48.34 KB, patch)
2015-08-08 14:24 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (48.34 KB, patch)
2015-08-08 14:25 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (51.12 KB, patch)
2015-08-08 14:36 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (51.27 KB, patch)
2015-08-08 16:00 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (51.78 KB, patch)
2015-08-08 16:01 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (51.78 KB, patch)
2015-08-08 16:15 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (51.95 KB, patch)
2015-08-08 20:23 PDT, Sam Weinig
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2015-08-08 13:59:10 PDT
Replace WebPageConfiguration with API::PageConfiguration and expose a C-SPI accessor for it
Comment 1 Sam Weinig 2015-08-08 14:06:17 PDT
This is a step on the way to making WKWebViewConfiguration backed by API::PageConfiguration.
Comment 2 Sam Weinig 2015-08-08 14:06:44 PDT
Created attachment 258573 [details]
Patch
Comment 3 Sam Weinig 2015-08-08 14:24:33 PDT
Created attachment 258574 [details]
Patch
Comment 4 Sam Weinig 2015-08-08 14:25:56 PDT
Created attachment 258575 [details]
Patch
Comment 5 Sam Weinig 2015-08-08 14:36:51 PDT
Created attachment 258576 [details]
Patch
Comment 6 Sam Weinig 2015-08-08 16:00:51 PDT
Created attachment 258577 [details]
Patch
Comment 7 Sam Weinig 2015-08-08 16:01:51 PDT
Created attachment 258578 [details]
Patch
Comment 8 Sam Weinig 2015-08-08 16:15:49 PDT
Created attachment 258579 [details]
Patch
Comment 9 Sam Weinig 2015-08-08 20:23:32 PDT
Created attachment 258587 [details]
Patch
Comment 10 Darin Adler 2015-08-09 18:10:05 PDT
Comment on attachment 258587 [details]
Patch

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

> Source/WebKit2/UIProcess/API/APIPageConfiguration.cpp:55
> +    auto copy = this->create();

Why the explicit "this->"?

> Source/WebKit2/UIProcess/API/APIPageConfiguration.cpp:70
> +    copy->m_processPool = this->m_processPool;
> +    copy->m_userContentController = this->m_userContentController;
> +    copy->m_pageGroup = this->m_pageGroup;
> +    copy->m_preferences = this->m_preferences;
> +    copy->m_preferenceValues = this->m_preferenceValues;
> +    copy->m_relatedPage = this->m_relatedPage;
> +    copy->m_visitedLinkProvider = this->m_visitedLinkProvider;
> +    copy->m_websiteDataStore = this->m_websiteDataStore;
> +    copy->m_sessionID = this->m_sessionID;
> +    copy->m_treatsSHA1SignedCertificatesAsInsecure = this->m_treatsSHA1SignedCertificatesAsInsecure;
> +
> +#if PLATFORM(IOS)
> +    copy->m_alwaysRunsAtForegroundPriority = this->m_alwaysRunsAtForegroundPriority;
> +#endif

This seems likely to be fragile. What will remind us to keep this in sync as we add data members? Is there a good reason to not use a copy constructor instead? It could be a private one to avoid confusion about reference counting, just as other constructors are private for the same reason.

> Source/WebKit2/UIProcess/API/C/WKPage.cpp:134
> +    auto configuration = toImpl(pageRef)->configuration().copy();
> +    return toAPI(&configuration.leakRef());

Is the local variable needed? I think it would read fine without it.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:305
> +    Ref<API::PageConfiguration> pageConfiguration = API::PageConfiguration::create();

auto?

> Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:1320
> +    Ref<API::PageConfiguration> pageConfiguration = API::PageConfiguration::create();

auto?

> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:1049
> +    Ref<API::PageConfiguration> pageConfiguration = API::PageConfiguration::create();

auto?

> Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm:229
> +    Ref<API::PageConfiguration> configuration = API::PageConfiguration::create();

auto?

> Source/WebKit2/UIProcess/API/mac/WKView.mm:3997
> +    Ref<API::PageConfiguration> configuration = API::PageConfiguration::create();

auto?

> Source/WebKit2/UIProcess/API/mac/WKView.mm:4007
> +    Ref<API::PageConfiguration> configuration = *toImpl(configurationRef);

auto?

> Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp:56
> +    Ref<API::PageConfiguration> pageConfiguration = API::PageConfiguration::create();

auto?
Comment 11 Sam Weinig 2015-08-09 19:28:11 PDT
(In reply to comment #10)
> Comment on attachment 258587 [details]
> Patch
> > Source/WebKit2/UIProcess/API/APIPageConfiguration.cpp:70
> > +    copy->m_processPool = this->m_processPool;
> > +    copy->m_userContentController = this->m_userContentController;
> > +    copy->m_pageGroup = this->m_pageGroup;
> > +    copy->m_preferences = this->m_preferences;
> > +    copy->m_preferenceValues = this->m_preferenceValues;
> > +    copy->m_relatedPage = this->m_relatedPage;
> > +    copy->m_visitedLinkProvider = this->m_visitedLinkProvider;
> > +    copy->m_websiteDataStore = this->m_websiteDataStore;
> > +    copy->m_sessionID = this->m_sessionID;
> > +    copy->m_treatsSHA1SignedCertificatesAsInsecure = this->m_treatsSHA1SignedCertificatesAsInsecure;
> > +
> > +#if PLATFORM(IOS)
> > +    copy->m_alwaysRunsAtForegroundPriority = this->m_alwaysRunsAtForegroundPriority;
> > +#endif
> 
> This seems likely to be fragile. What will remind us to keep this in sync as
> we add data members? Is there a good reason to not use a copy constructor
> instead? It could be a private one to avoid confusion about reference
> counting, just as other constructors are private for the same reason.

Honestly, I was just blindingly following APIProcessPoolConfiguration, which does it this way. A copy constructor that copy calls would be cleaner. I'll do that for both classes in a follow up.
Comment 12 Sam Weinig 2015-08-10 13:52:10 PDT
Committed r188228: <http://trac.webkit.org/changeset/188228>