Title: [98159] trunk
Revision
98159
Author
wei...@apple.com
Date
2011-10-21 15:09:22 -0700 (Fri, 21 Oct 2011)

Log Message

Remove ability to create a WKView without a WKContextRef and WKPageGroupRef
https://bugs.webkit.org/show_bug.cgi?id=70653

Reviewed by Simon Fraser.

Source/WebKit2: 

Requiring a context and pagegroup removes the concept of global contexts,
which is something that is both confusing, and makes Objective-C wrapping
harder.

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:processCluster:]):
* UIProcess/API/mac/WKViewPrivate.h:
Remove init methods that didn't take both a context and a pagegroup.

Tools: 

* MiniBrowser/mac/AppDelegate.h:
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
(-[BrowserAppDelegate newWindow:]):
(-[BrowserAppDelegate openPanelDidEnd:returnCode:contextInfo:]):
* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController initWithContext:pageGroup:]):
(-[BrowserWindowController windowWillClose:]):
(createNewPage):
(-[BrowserWindowController awakeFromNib]):
* TestWebKitAPI/mac/WebKitAgnosticTest.mm:
(TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test):
Update testing code to pass a PageGroup as necessary.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98158 => 98159)


--- trunk/Source/WebKit2/ChangeLog	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-21 22:09:22 UTC (rev 98159)
@@ -1,3 +1,19 @@
+2011-10-21  Sam Weinig  <s...@webkit.org>
+
+        Remove ability to create a WKView without a WKContextRef and WKPageGroupRef
+        https://bugs.webkit.org/show_bug.cgi?id=70653
+
+        Reviewed by Simon Fraser.
+
+        Requiring a context and pagegroup removes the concept of global contexts,
+        which is something that is both confusing, and makes Objective-C wrapping
+        harder.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:processCluster:]):
+        * UIProcess/API/mac/WKViewPrivate.h:
+        Remove init methods that didn't take both a context and a pagegroup.
+
 2011-10-21  Alexey Proskuryakov  <a...@apple.com>
 
         [WK2] Crash after printing a view with accelerated compositing content

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (98158 => 98159)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-10-21 22:09:22 UTC (rev 98159)
@@ -198,14 +198,9 @@
 
 @implementation WKView
 
-- (id)initWithFrame:(NSRect)frame
-{
-    return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())];
-}
-
 - (id)initWithFrame:(NSRect)frame processCluster:(WKProcessCluster *)processCluster
 {
-    return [self initWithFrame:frame contextRef:processCluster.contextRef];
+    return [self initWithFrame:frame contextRef:processCluster.contextRef pageGroupRef:0];
 }
 
 - (void)dealloc
@@ -2571,11 +2566,6 @@
 
 @implementation WKView (Private)
 
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef
-{   
-    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:nil];
-}
-
 - (void)_registerDraggedTypes
 {
     NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()];

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h (98158 => 98159)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2011-10-21 22:09:22 UTC (rev 98159)
@@ -31,7 +31,6 @@
 
 @property(readonly) WKPageRef pageRef;
 
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef;
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
 
 - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;

Modified: trunk/Tools/ChangeLog (98158 => 98159)


--- trunk/Tools/ChangeLog	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/ChangeLog	2011-10-21 22:09:22 UTC (rev 98159)
@@ -1,3 +1,25 @@
+2011-10-21  Sam Weinig  <s...@webkit.org>
+
+        Remove ability to create a WKView without a WKContextRef and WKPageGroupRef
+        https://bugs.webkit.org/show_bug.cgi?id=70653
+
+        Reviewed by Simon Fraser.
+
+        * MiniBrowser/mac/AppDelegate.h:
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate init]):
+        (-[BrowserAppDelegate newWindow:]):
+        (-[BrowserAppDelegate openPanelDidEnd:returnCode:contextInfo:]):
+        * MiniBrowser/mac/BrowserWindowController.h:
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController initWithContext:pageGroup:]):
+        (-[BrowserWindowController windowWillClose:]):
+        (createNewPage):
+        (-[BrowserWindowController awakeFromNib]):
+        * TestWebKitAPI/mac/WebKitAgnosticTest.mm:
+        (TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test):
+        Update testing code to pass a PageGroup as necessary.
+
 2011-10-21  Leandro Pereira  <lean...@profusion.mobi>
 
         webkitpy: Teach NRWT about the EFL port

Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.h (98158 => 98159)


--- trunk/Tools/MiniBrowser/mac/AppDelegate.h	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.h	2011-10-21 22:09:22 UTC (rev 98159)
@@ -33,6 +33,7 @@
     ProcessModel _currentProcessModel;
     WKContextRef _threadContext;
     WKContextRef _processContext;
+    WKPageGroupRef _pageGroup;
 }
 
 - (WKContextRef)getCurrentContext;

Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (98158 => 98159)


--- trunk/Tools/MiniBrowser/mac/AppDelegate.m	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m	2011-10-21 22:09:22 UTC (rev 98159)
@@ -148,6 +148,10 @@
         WKContextSetCacheModel(_processContext, kWKCacheModelPrimaryWebBrowser);
 
         WKRelease(bundlePath);
+        
+        WKStringRef pageGroupIdentifier = WKStringCreateWithCFString(CFSTR("MiniBrowser"));
+        _pageGroup = WKPageGroupCreateWithIdentifier(pageGroupIdentifier);
+        WKRelease(pageGroupIdentifier);
     }
 
     return self;
@@ -155,7 +159,7 @@
 
 - (IBAction)newWindow:(id)sender
 {
-    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext]];
+    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext] pageGroup:_pageGroup];
     [[controller window] makeKeyAndOrderFront:sender];
     
     [controller loadURLString:defaultURL];
@@ -256,7 +260,7 @@
 
     BrowserWindowController *controller = [self frontmostBrowserWindowController];
     if (!controller) {
-        controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext]];
+        controller = [[BrowserWindowController alloc] initWithContext:[self getCurrentContext] pageGroup:_pageGroup];
         [[controller window] makeKeyAndOrderFront:self];
     }
     

Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.h (98158 => 98159)


--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.h	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.h	2011-10-21 22:09:22 UTC (rev 98159)
@@ -35,6 +35,7 @@
     IBOutlet NSWindow *findPanelWindow;
     
     WKContextRef _context;
+    WKPageGroupRef _pageGroup;
     WKView *_webView;
     BOOL _zoomTextOnly;
 }
@@ -47,7 +48,7 @@
 - (IBAction)showHideWebView:(id)sender;
 - (IBAction)removeReinsertWebView:(id)sender;
 
-- (id)initWithContext:(WKContextRef)context;
+- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup;
 - (void)loadURLString:(NSString *)urlString;
 - (void)applicationTerminating;
 

Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (98158 => 98159)


--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2011-10-21 22:09:22 UTC (rev 98159)
@@ -44,10 +44,11 @@
 
 @implementation BrowserWindowController
 
-- (id)initWithContext:(WKContextRef)context
+- (id)initWithContext:(WKContextRef)context pageGroup:(WKPageGroupRef)pageGroup
 {
     if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
         _context = WKRetain(context);
+        _pageGroup = WKRetain(pageGroup);
         _zoomTextOnly = NO;
     }
     
@@ -160,6 +161,8 @@
 {
     WKRelease(_context);
     _context = 0;
+    WKRelease(_pageGroup);
+    _pageGroup = 0;
 }
 
 - (void)applicationTerminating
@@ -381,7 +384,7 @@
 static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton button, const void* clientInfo)
 {
     LOG(@"createNewPage");
-    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:WKPageGetContext(page)];
+    BrowserWindowController *controller = [[BrowserWindowController alloc] initWithContext:WKPageGetContext(page) pageGroup:WKPageGetPageGroup(page)];
     [controller loadWindow];
 
     return controller->_webView.pageRef;
@@ -566,7 +569,7 @@
 
 - (void)awakeFromNib
 {
-    _webView = [[WKView alloc] initWithFrame:[containerView frame] contextRef:_context];
+    _webView = [[WKView alloc] initWithFrame:[containerView frame] contextRef:_context pageGroupRef:_pageGroup];
 
     [containerView addSubview:_webView];
     [_webView setFrame:[containerView frame]];

Modified: trunk/Tools/TestWebKitAPI/mac/WebKitAgnosticTest.mm (98158 => 98159)


--- trunk/Tools/TestWebKitAPI/mac/WebKitAgnosticTest.mm	2011-10-21 22:01:54 UTC (rev 98158)
+++ trunk/Tools/TestWebKitAPI/mac/WebKitAgnosticTest.mm	2011-10-21 22:09:22 UTC (rev 98159)
@@ -96,7 +96,8 @@
 void WebKitAgnosticTest::runWebKit2Test()
 {
     WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
-    RetainPtr<WKView> view(AdoptNS, [[WKView alloc] initWithFrame:viewFrame contextRef:context.get()]);
+    WKRetainPtr<WKPageGroupRef> pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("WebKitAgnosticTest").get()));
+    RetainPtr<WKView> view(AdoptNS, [[WKView alloc] initWithFrame:viewFrame contextRef:context.get() pageGroupRef:pageGroup.get()]);
     setPageLoaderClient([view.get() pageRef], &didFinishLoad);
     initializeView(view.get());
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to