Title: [128101] trunk/Source/WebKit2
- Revision
- 128101
- Author
- [email protected]
- Date
- 2012-09-10 13:52:04 -0700 (Mon, 10 Sep 2012)
Log Message
[WK2] Add an API to open a page in same process
https://bugs.webkit.org/show_bug.cgi?id=96306
Reviewed by Anders Carlsson.
The name "related" inspired by <http://wiki.whatwg.org/wiki/Links_to_Unrelated_Browsing_Contexts>.
* UIProcess/API/mac/WKView.h: Added an API. It's unwieldy, but I blame
WKBrowsingContextGroup, not the related view.
* UIProcess/API/mac/WKViewPrivate.h: Matching SPI for clients that mostly use
C APIs.
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:processGroup:browsingContextGroup:]): Use new back-end
signature.
(-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
Get page from WKView, and call back-end.
(-[WKView initWithFrame:contextRef:pageGroupRef:]): Reimplement existing method
by calling new, more powerful one.
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): Just one change,
pass relatedPage to the context.
* UIProcess/WebContext.cpp: (WebKit::WebContext::createWebPage): If related page
is not null, use its process.
* UIProcess/WebContext.h: (WebContext): Updated createWebPage signature.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (128100 => 128101)
--- trunk/Source/WebKit2/ChangeLog 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-10 20:52:04 UTC (rev 128101)
@@ -1,3 +1,33 @@
+2012-09-10 Alexey Proskuryakov <[email protected]>
+
+ [WK2] Add an API to open a page in same process
+ https://bugs.webkit.org/show_bug.cgi?id=96306
+
+ Reviewed by Anders Carlsson.
+
+ The name "related" inspired by <http://wiki.whatwg.org/wiki/Links_to_Unrelated_Browsing_Contexts>.
+
+ * UIProcess/API/mac/WKView.h: Added an API. It's unwieldy, but I blame
+ WKBrowsingContextGroup, not the related view.
+
+ * UIProcess/API/mac/WKViewPrivate.h: Matching SPI for clients that mostly use
+ C APIs.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView initWithFrame:processGroup:browsingContextGroup:]): Use new back-end
+ signature.
+ (-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
+ Get page from WKView, and call back-end.
+ (-[WKView initWithFrame:contextRef:pageGroupRef:]): Reimplement existing method
+ by calling new, more powerful one.
+ (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): Just one change,
+ pass relatedPage to the context.
+
+ * UIProcess/WebContext.cpp: (WebKit::WebContext::createWebPage): If related page
+ is not null, use its process.
+
+ * UIProcess/WebContext.h: (WebContext): Updated createWebPage signature.
+
2012-09-10 Brady Eidson <[email protected]>
_javascript_ in foreground tabs should not wait synchronously for plug-ins to load
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.h (128100 => 128101)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.h 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.h 2012-09-10 20:52:04 UTC (rev 128101)
@@ -39,6 +39,7 @@
}
- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup;
+- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView;
@property(readonly) WKBrowsingContextController *browsingContextController;
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (128100 => 128101)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-09-10 20:52:04 UTC (rev 128101)
@@ -247,9 +247,14 @@
- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
{
- return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef];
+ return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:nil];
}
+- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView
+{
+ return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:relatedView ? toAPI(relatedView->_data->_page.get()) : nil];
+}
+
- (void)dealloc
{
_data->_page->close();
@@ -2986,6 +2991,11 @@
- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
{
+ return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
+}
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
+{
self = [super initWithFrame:frame];
if (!self)
return nil;
@@ -3016,7 +3026,7 @@
_data = [[WKViewData alloc] init];
_data->_pageClient = PageClientImpl::create(self);
- _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef));
+ _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef), toImpl(relatedPage));
_data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
_data->_page->initializeWebPage();
#if ENABLE(FULLSCREEN_API)
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h (128100 => 128101)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h 2012-09-10 20:52:04 UTC (rev 128101)
@@ -32,6 +32,7 @@
@property(readonly) WKPageRef pageRef;
- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;
- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef;
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (128100 => 128101)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-09-10 20:52:04 UTC (rev 128101)
@@ -501,20 +501,21 @@
m_processes.remove(m_processes.find(process));
}
-PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient* pageClient, WebPageGroup* pageGroup)
+PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient* pageClient, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
{
RefPtr<WebProcessProxy> process;
if (m_processModel == ProcessModelSharedSecondaryProcess) {
ensureSharedWebProcess();
process = m_processes[0];
} else {
- // FIXME (Multi-WebProcess): Add logic for sharing a process.
- // <rdar://problem/12218164> window.open() should create pages in the same process.
- // <rdar://problem/12239661> Consider limiting the number of web processes in per-tab process model
if (m_haveInitialEmptyProcess) {
process = m_processes.last();
m_haveInitialEmptyProcess = false;
+ } else if (relatedPage) {
+ // Sharing processes, e.g. when creating the page via window.open().
+ process = relatedPage->process();
} else {
+ // FIXME (Multi-WebProcess): <rdar://problem/12239661> Consider limiting the number of web processes in per-tab process model.
process = createNewWebProcess();
m_processes.append(process);
}
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (128100 => 128101)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2012-09-10 20:51:13 UTC (rev 128100)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2012-09-10 20:52:04 UTC (rev 128101)
@@ -103,7 +103,7 @@
// Disconnect the process from the context.
void disconnectProcess(WebProcessProxy*);
- PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebPageGroup*);
+ PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebPageGroup*, WebPageProxy* relatedPage);
WebProcessProxy* relaunchProcessIfNecessary();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes