Diff
Modified: trunk/Source/WebKit2/ChangeLog (159828 => 159829)
--- trunk/Source/WebKit2/ChangeLog 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/ChangeLog 2013-11-28 02:03:41 UTC (rev 159829)
@@ -1,5 +1,37 @@
2013-11-27 Sam Weinig <[email protected]>
+ Make WKProcessGroup work with WKObject wrapping
+ https://bugs.webkit.org/show_bug.cgi?id=124952
+
+ Reviewed by Dan Bernstein.
+
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject):
+ Add support for WKProcessGroup.
+
+ * UIProcess/API/mac/WKProcessGroup.mm:
+ (-[WKProcessGroup initWithInjectedBundleURL:]):
+ (-[WKProcessGroup dealloc]):
+ (-[WKProcessGroup API::]):
+ (-[WKProcessGroup _contextRef]):
+ (-[WKProcessGroup _geolocationProvider]):
+ Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline
+
+ * UIProcess/API/mac/WKProcessGroupInternal.h: Added.
+ (WebKit::wrapper):
+ Add wrapper() helper and declare conformance to the WKObject protocol.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::create):
+ (WebKit::WebContext::WebContext):
+ * UIProcess/WebContext.h:
+ Make the WebContext constructor public (for use with Object::constructInWrapper) and remove unused ProcessModel parameter.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add new file.
+
+2013-11-27 Sam Weinig <[email protected]>
+
Make WKBrowsingContextGroup work with WKObject wrapping
https://bugs.webkit.org/show_bug.cgi?id=124948
Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (159828 => 159829)
--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2013-11-28 02:03:41 UTC (rev 159829)
@@ -31,6 +31,7 @@
#import "WKBackForwardListInternal.h"
#import "WKBackForwardListItemInternal.h"
#import "WKBrowsingContextGroupInternal.h"
+#import "WKProcessGroupInternal.h"
#import "WKNSArray.h"
#import "WKNSDictionary.h"
#import "WKNSError.h"
@@ -71,6 +72,10 @@
wrapper = [WKBackForwardListItem alloc];
break;
+ case Type::Context:
+ wrapper = [WKProcessGroup alloc];
+ break;
+
case Type::Dictionary:
wrapper = [WKNSDictionary alloc];
break;
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm (159828 => 159829)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm 2013-11-28 02:03:41 UTC (rev 159829)
@@ -24,7 +24,7 @@
*/
#import "config.h"
-#import "WKProcessGroupPrivate.h"
+#import "WKProcessGroupInternal.h"
#if WK_API_ENABLED
@@ -52,8 +52,7 @@
using namespace WebKit;
@implementation WKProcessGroup {
- // Underlying context object.
- WKRetainPtr<WKContextRef> _contextRef;
+ std::aligned_storage<sizeof(WebContext), std::alignment_of<WebContext>::value>::type _context;
#if PLATFORM(IOS)
RetainPtr<WKGeolocationProviderIOS> _geolocationProvider;
@@ -176,41 +175,43 @@
InitWebCoreThreadSystemInterface();
#endif
- if (bundleURL)
- _contextRef = adoptWK(WKContextCreateWithInjectedBundlePath(adoptWK(WKStringCreateWithCFString((CFStringRef)[bundleURL path])).get()));
- else
- _contextRef = adoptWK(WKContextCreate());
+ API::Object::constructInWrapper<WebContext>(self, bundleURL ? String([bundleURL path]) : String());
- setUpConnectionClient(self, _contextRef.get());
- setUpInectedBundleClient(self, _contextRef.get());
- setUpHistoryClient(self, _contextRef.get());
+ setUpConnectionClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
+ setUpInectedBundleClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
+ setUpHistoryClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
return self;
}
- (void)dealloc
{
- WKContextSetConnectionClient(_contextRef.get(), 0);
- WKContextSetInjectedBundleClient(_contextRef.get(), 0);
- WKContextSetHistoryClient(_contextRef.get(), 0);
+ reinterpret_cast<WebContext*>(&_context)->~WebContext();
[super dealloc];
}
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+ return *reinterpret_cast<API::Object*>(&_context);
+}
+
@end
@implementation WKProcessGroup (Private)
- (WKContextRef)_contextRef
{
- return _contextRef.get();
+ return toAPI(reinterpret_cast<WebContext*>(&_context));
}
#if PLATFORM(IOS)
- (WKGeolocationProviderIOS *)_geolocationProvider
{
if (!_geolocationProvider)
- _geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:toImpl(_contextRef.get())]);
+ _geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:reinterpret_cast<WebContext*>(&_context)]);
return _geolocationProvider.get();
}
#endif // PLATFORM(IOS)
Added: trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroupInternal.h (0 => 159829)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroupInternal.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKProcessGroupInternal.h 2013-11-28 02:03:41 UTC (rev 159829)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKProcessGroupPrivate.h"
+
+#if WK_API_ENABLED
+
+#import "WKObject.h"
+#import "WebContext.h"
+
+namespace WebKit {
+
+inline WKProcessGroup *wrapper(WebContext& context)
+{
+ ASSERT([context.wrapper() isKindOfClass:[WKProcessGroup class]]);
+ return (WKProcessGroup *)context.wrapper();
+}
+
+}
+
+@interface WKProcessGroup () <WKObject>
+@end
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (159828 => 159829)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2013-11-28 02:03:41 UTC (rev 159829)
@@ -108,7 +108,7 @@
PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
{
InitializeWebKit2();
- return adoptRef(new WebContext(ProcessModelSharedSecondaryProcess, injectedBundlePath));
+ return adoptRef(new WebContext(injectedBundlePath));
}
static Vector<WebContext*>& contexts()
@@ -131,8 +131,8 @@
}
#endif
-WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePath)
- : m_processModel(processModel)
+WebContext::WebContext(const String& injectedBundlePath)
+ : m_processModel(ProcessModelSharedSecondaryProcess)
, m_webProcessCountLimit(UINT_MAX)
, m_haveInitialEmptyProcess(false)
, m_processWithPageCache(0)
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (159828 => 159829)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2013-11-28 02:03:41 UTC (rev 159829)
@@ -96,8 +96,11 @@
#endif
{
public:
+ WebContext(const String& injectedBundlePath);
+
static PassRefPtr<WebContext> create(const String& injectedBundlePath);
virtual ~WebContext();
+
#if PLATFORM(IOS)
static WebContext *sharedProcessContext();
#endif
@@ -313,7 +316,6 @@
void resetHSTSHosts();
private:
- WebContext(ProcessModel, const String& injectedBundlePath);
void platformInitialize();
void platformInitializeWebProcess(WebProcessCreationParameters&);
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (159828 => 159829)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-11-28 01:20:54 UTC (rev 159828)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-11-28 02:03:41 UTC (rev 159829)
@@ -687,6 +687,7 @@
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 */; };
@@ -2238,6 +2239,7 @@
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>"; };
@@ -4651,6 +4653,7 @@
BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */,
BCBAACE5145225C90053F82F /* WKProcessGroup.h */,
BCBAACE6145225CA0053F82F /* WKProcessGroup.mm */,
+ 7C1FB3BF1846AEFC001A03D8 /* WKProcessGroupInternal.h */,
BCBAACE7145225CB0053F82F /* WKProcessGroupPrivate.h */,
7CD5EBBD1746B04C000C1C45 /* WKTypeRefWrapper.h */,
7CD5EBBC1746B04C000C1C45 /* WKTypeRefWrapper.mm */,
@@ -6068,6 +6071,7 @@
37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */,
51D0D437183B353D0097041D /* DatabaseProcessIDBConnectionMessages.h in Headers */,
E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */,
+ 7C1FB3C01846AEFC001A03D8 /* WKProcessGroupInternal.h in Headers */,
BCBAACEB145225E30053F82F /* WKProcessGroup.h in Headers */,
BCBAACED145225E30053F82F /* WKProcessGroupPrivate.h in Headers */,
512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,