Commit 26c7ef46 authored by andersca@apple.com's avatar andersca@apple.com

WKProcessClass should create a WebContext

https://bugs.webkit.org/show_bug.cgi?id=127449
<rdar://problem/15885582>

Reviewed by Dan Bernstein.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKBrowsingContextController.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKProcessClass.mm:
(-[WKProcessClass initWithConfiguration:]):
(-[WKProcessClass dealloc]):
(-[WKProcessClass API::]):
* UIProcess/API/Cocoa/WKProcessClassInternal.h: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroupInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0a4afe21
2014-01-22 Anders Carlsson <andersca@apple.com>
WKProcessClass should create a WebContext
https://bugs.webkit.org/show_bug.cgi?id=127449
<rdar://problem/15885582>
Reviewed by Dan Bernstein.
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKBrowsingContextController.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKProcessClass.mm:
(-[WKProcessClass initWithConfiguration:]):
(-[WKProcessClass dealloc]):
(-[WKProcessClass API::]):
* UIProcess/API/Cocoa/WKProcessClassInternal.h: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroupInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
* WebKit2.xcodeproj/project.pbxproj:
2014-01-22 Tim Horton <timothy_horton@apple.com>
Crashes in DrawingAreaProxy::setExposedRect (null DrawingAreaProxy)
......
......@@ -42,7 +42,7 @@
#import "WKNSURLAuthenticationChallenge.h"
#import "WKNSURLProtectionSpace.h"
#import "WKNavigationDataInternal.h"
#import "WKProcessGroupInternal.h"
#import "WKProcessClassInternal.h"
#import "WKWebProcessPlugInBrowserContextControllerInternal.h"
#import "WKWebProcessPlugInFrameInternal.h"
#import "WKWebProcessPlugInHitTestResultInternal.h"
......@@ -101,7 +101,7 @@ void* Object::newObject(size_t size, Type type)
break;
case Type::Context:
wrapper = [WKProcessGroup alloc];
wrapper = [WKProcessClass alloc];
break;
case Type::Data:
......
......@@ -40,9 +40,6 @@
WK_API_CLASS
@interface WKBrowsingContextController : NSObject
@property (readonly) WKProcessGroup *processGroup;
@property (readonly) WKBrowsingContextGroup *browsingContextGroup;
#pragma mark Delegates
@property (weak) id <WKBrowsingContextLoadDelegate> loadDelegate;
......
......@@ -47,7 +47,7 @@
#import "WKNSURLAuthenticationChallenge.h"
#import "WKNSURLExtras.h"
#import "WKNSURLProtectionSpace.h"
#import "WKProcessGroupInternal.h"
#import "WKProcessGroupPrivate.h"
#import "WKRemoteObjectRegistryInternal.h"
#import "WKRenderingProgressEventsInternal.h"
#import "WKRetainPtr.h"
......@@ -164,16 +164,6 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
_page->pageLoadState().addObserver(*_pageLoadStateObserver);
}
- (WKProcessGroup *)processGroup
{
return wrapper(_page->process().context());
}
- (WKBrowsingContextGroup *)browsingContextGroup
{
return wrapper(_page->pageGroup());
}
#pragma mark Loading
+ (void)registerSchemeForCustomProtocol:(NSString *)scheme
......
......@@ -24,14 +24,23 @@
*/
#import "config.h"
#import "WKProcessClass.h"
#import "WKProcessClassInternal.h"
#if WK_API_ENABLED
#import "WKObject.h"
#import "WKProcessClassConfigurationPrivate.h"
#import "WebContext.h"
#import <wtf/RetainPtr.h>
#if PLATFORM(IOS)
#import <WebCore/WebCoreThreadSystemInterface.h>
#endif
@implementation WKProcessClass {
RetainPtr<WKProcessClassConfiguration> _configuration;
API::ObjectStorage<WebKit::WebContext> _context;
}
- (instancetype)initWithConfiguration:(WKProcessClassConfiguration *)configuration
......@@ -41,16 +50,41 @@
_configuration = adoptNS([configuration copy]);
// FIXME: Create a WebContext.
#if PLATFORM(IOS)
// FIXME: Remove once <rdar://problem/15256572> is fixed.
InitWebCoreThreadSystemInterface();
#endif
String bundlePath;
if (NSURL *bundleURL = [_configuration _injectedBundleURL]) {
if (!bundleURL.isFileURL)
[NSException raise:NSInvalidArgumentException format:@"Injected Bundle URL must be a file URL"];
bundlePath = bundleURL.path;
}
API::Object::constructInWrapper<WebKit::WebContext>(self, bundlePath);
return self;
}
- (void)dealloc
{
_context->~WebContext();
[super dealloc];
}
- (WKProcessClassConfiguration *)configuration
{
return [[_configuration copy] autorelease];
}
- (API::Object&)_apiObject
{
return *_context;
}
@end
#endif // WK_API_ENABLED
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
* Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WKProcessGroupPrivate.h"
#import "WKProcessClass.h"
#if WK_API_ENABLED
......@@ -32,15 +32,15 @@
namespace WebKit {
inline WKProcessGroup *wrapper(WebContext& context)
inline WKProcessClass *wrapper(WebContext& context)
{
ASSERT([context.wrapper() isKindOfClass:[WKProcessGroup class]]);
return (WKProcessGroup *)context.wrapper();
ASSERT([context.wrapper() isKindOfClass:[WKProcessClass class]]);
return (WKProcessClass *)context.wrapper();
}
}
@interface WKProcessGroup () <WKObject>
@interface WKProcessClass () <WKObject>
@end
#endif // WK_API_ENABLED
......@@ -24,7 +24,7 @@
*/
#import "config.h"
#import "WKProcessGroupInternal.h"
#import "WKProcessGroupPrivate.h"
#if WK_API_ENABLED
......@@ -34,7 +34,6 @@
#import "WKBrowsingContextControllerInternal.h"
#import "WKBrowsingContextHistoryDelegate.h"
#import "WKConnectionInternal.h"
#import "WKContext.h"
#import "WKNSString.h"
#import "WKNSURL.h"
#import "WKNavigationDataInternal.h"
......@@ -42,6 +41,7 @@
#import "WKStringCF.h"
#import "WeakObjCPtr.h"
#import "WebCertificateInfo.h"
#import "WebContext.h"
#import "WebFrameProxy.h"
#import <wtf/RetainPtr.h>
......@@ -54,7 +54,7 @@
using namespace WebKit;
@implementation WKProcessGroup {
API::ObjectStorage<WebContext> _context;
RefPtr<WebContext> _context;
WeakObjCPtr<id <WKProcessGroupDelegate>> _delegate;
......@@ -63,13 +63,6 @@ using namespace WebKit;
#endif // PLATFORM(IOS)
}
- (void)dealloc
{
_context->~WebContext();
[super dealloc];
}
static void didCreateConnection(WKContextRef, WKConnectionRef connectionRef, const void* clientInfo)
{
WKProcessGroup *processGroup = (WKProcessGroup *)clientInfo;
......@@ -196,7 +189,7 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex
InitWebCoreThreadSystemInterface();
#endif
API::Object::constructInWrapper<WebContext>(self, bundleURL ? String([bundleURL path]) : String());
_context = WebContext::create(bundleURL ? String([bundleURL path]) : String());
setUpConnectionClient(self, toAPI(_context.get()));
setUpInectedBundleClient(self, toAPI(_context.get()));
......@@ -219,13 +212,6 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex
_delegate = delegate;
}
#pragma mark WKObject protocol implementation
- (API::Object&)_apiObject
{
return *_context;
}
@end
@implementation WKProcessGroup (Private)
......
......@@ -34,7 +34,7 @@
#import "WKBrowsingContextGroupPrivate.h"
#import "WKGeolocationProviderIOS.h"
#import "WKInteractionView.h"
#import "WKProcessGroupInternal.h"
#import "WKProcessGroupPrivate.h"
#import "WebContext.h"
#import "WebFrameProxy.h"
#import "WebPageGroup.h"
......@@ -299,7 +299,9 @@ using namespace WebKit;
- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)permissionRequest
{
[[wrapper(_page->process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&permissionRequest) window:[self window]];
// FIXME: The line below is commented out since wrapper(WebContext&) now returns a WKProcessClass.
// As part of the new API we should figure out where geolocation fits in, see <rdar://problem/15885544>.
// [[wrapper(_page->process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&permissionRequest) window:[self window]];
}
@end
......@@ -144,6 +144,7 @@
1A334DEE16DE8F88006A8E38 /* StorageAreaMapMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A334DEC16DE8F88006A8E38 /* StorageAreaMapMessages.h */; };
1A3CC16618906ACF001E6ED8 /* WKWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A3CC16418906ACF001E6ED8 /* WKWebView.mm */; };
1A3CC16718906ACF001E6ED8 /* WKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3CC16518906ACF001E6ED8 /* WKWebView.h */; };
1A3CC16918907EB0001E6ED8 /* WKProcessClassInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3CC16818907EB0001E6ED8 /* WKProcessClassInternal.h */; };
1A3D610113A7CC2A00F95D4E /* PluginModuleInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */; };
1A3D610213A7CC2A00F95D4E /* PluginModuleInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */; };
1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */; };
......@@ -821,7 +822,6 @@
7C135AA8173B0BCA00586AE2 /* WKPluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */; };
7C135AA9173B0BCA00586AE2 /* WKPluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C135AAC173B0CFF00586AE2 /* PluginInformationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C135AAA173B0CFF00586AE2 /* PluginInformationMac.mm */; };
7C1FB3C01846AEFC001A03D8 /* WKProcessGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1FB3BF1846AEFC001A03D8 /* WKProcessGroupInternal.h */; };
7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
......@@ -1763,6 +1763,7 @@
1A334DEC16DE8F88006A8E38 /* StorageAreaMapMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaMapMessages.h; sourceTree = "<group>"; };
1A3CC16418906ACF001E6ED8 /* WKWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebView.mm; sourceTree = "<group>"; };
1A3CC16518906ACF001E6ED8 /* WKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebView.h; sourceTree = "<group>"; };
1A3CC16818907EB0001E6ED8 /* WKProcessClassInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessClassInternal.h; sourceTree = "<group>"; };
1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginModuleInfo.cpp; sourceTree = "<group>"; };
1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginModuleInfo.h; sourceTree = "<group>"; };
1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentCoders.cpp; sourceTree = "<group>"; };
......@@ -2517,7 +2518,6 @@
7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPluginInformation.cpp; sourceTree = "<group>"; };
7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginInformation.h; sourceTree = "<group>"; };
7C135AAA173B0CFF00586AE2 /* PluginInformationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInformationMac.mm; sourceTree = "<group>"; };
7C1FB3BF1846AEFC001A03D8 /* WKProcessGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessGroupInternal.h; sourceTree = "<group>"; };
7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = "<group>"; };
7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; };
7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; };
......@@ -3504,7 +3504,6 @@
37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */,
BCBAACE5145225C90053F82F /* WKProcessGroup.h */,
BCBAACE6145225CA0053F82F /* WKProcessGroup.mm */,
7C1FB3BF1846AEFC001A03D8 /* WKProcessGroupInternal.h */,
BCBAACE7145225CB0053F82F /* WKProcessGroupPrivate.h */,
75A8D2C4187CCF9F00C39C9E /* WKSession.h */,
75A8D2C5187CCF9F00C39C9E /* WKSession.mm */,
......@@ -4224,6 +4223,7 @@
1A43E828188F3CDC009E4D30 /* WKProcessClassConfiguration.h */,
1A43E827188F3CDC009E4D30 /* WKProcessClassConfiguration.mm */,
1A43E82B188F3CF5009E4D30 /* WKProcessClassConfigurationPrivate.h */,
1A3CC16818907EB0001E6ED8 /* WKProcessClassInternal.h */,
1A3CC16518906ACF001E6ED8 /* WKWebView.h */,
1A3CC16418906ACF001E6ED8 /* WKWebView.mm */,
1ADF59191890528E0043C145 /* WKWebViewConfiguration.h */,
......@@ -6203,6 +6203,7 @@
1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
1A232903162C867300D82F7A /* MessageDecoder.h in Headers */,
51FCB18617BBFE0300394CD8 /* AsynchronousNetworkLoaderClient.h in Headers */,
1A3CC16918907EB0001E6ED8 /* WKProcessClassInternal.h in Headers */,
2D1B5D5E185869C8006C6596 /* ViewGestureControllerMessages.h in Headers */,
1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */,
1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */,
......@@ -6673,7 +6674,6 @@
37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */,
51D0D437183B353D0097041D /* DatabaseProcessIDBConnectionMessages.h in Headers */,
E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */,
7C1FB3C01846AEFC001A03D8 /* WKProcessGroupInternal.h in Headers */,
BCBAACED145225E30053F82F /* WKProcessGroupPrivate.h in Headers */,
512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,
518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment