Bug 147811

Summary: Replace WebPageConfiguration with API::PageConfiguration and expose a C-SPI accessor for it
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=148471
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch darin: review+

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>