<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159824] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159824">159824</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2013-11-27 14:48:32 -0800 (Wed, 27 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make WKBrowsingContextGroup work with WKObject wrapping
https://bugs.webkit.org/show_bug.cgi?id=124948

Reviewed by Dan Bernstein.

- Adds mechanism to use the inline data wrapping mechanism when the Objective-C wrapper is created
  by the caller (rather than by Object::newObject).
- Adopts the mechanism for WKBrowsingContextGroup.

* Shared/APIObject.h:
(API::Object::constructInWrapper):
Add a helper which does a forwarding placement-new into the API::Object of the passed in wrapper, after which it sets up m_wrapper.

(API::TypedObject::operator new):
Add a operator new to for placement-new. Also make TypedObject friends with Object so that constructInWrapper can call this.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
Add support for WKBrowsingContextGroup.

* UIProcess/API/mac/WKBrowsingContextGroup.mm:
(-[WKBrowsingContextGroup API::]):
(-[WKBrowsingContextGroup dealloc]):
(-[WKBrowsingContextGroup initWithIdentifier:]):
(-[WKBrowsingContextGroup allowsJavaScript]):
(-[WKBrowsingContextGroup setAllowsJavaScript:]):
(-[WKBrowsingContextGroup allowsJavaScriptMarkup]):
(-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]):
(-[WKBrowsingContextGroup allowsPlugIns]):
(-[WKBrowsingContextGroup setAllowsPlugIns:]):
(-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]):
(-[WKBrowsingContextGroup removeAllUserStyleSheets]):
(-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]):
(-[WKBrowsingContextGroup removeAllUserScripts]):
(-[WKBrowsingContextGroup _pageGroupRef]):
Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline (modeled on WKBackForwardList).

* UIProcess/API/mac/WKBrowsingContextGroupInternal.h: Added.
(WebKit::wrapper):
Add wrapper() helper and declare conformance to the WKObject protocol.

* UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::create):
(WebKit::WebPageGroup::WebPageGroup):
* UIProcess/WebPageGroup.h:
Make the WebPageGroup constructor public (for use with Object::constructInWrapper) and move being set in the webPageGroupMap()
to the constructor.

* WebKit2.xcodeproj/project.pbxproj:
Add new file.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIObjecth">trunk/Source/WebKit2/Shared/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKBrowsingContextGroupmm">trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageGroupcpp">trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageGrouph">trunk/Source/WebKit2/UIProcess/WebPageGroup.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKBrowsingContextGroupInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroupInternal.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/ChangeLog        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2013-11-27  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Make WKBrowsingContextGroup work with WKObject wrapping
+        https://bugs.webkit.org/show_bug.cgi?id=124948
+
+        Reviewed by Dan Bernstein.
+
+        - Adds mechanism to use the inline data wrapping mechanism when the Objective-C wrapper is created
+          by the caller (rather than by Object::newObject).
+        - Adopts the mechanism for WKBrowsingContextGroup.
+
+        * Shared/APIObject.h:
+        (API::Object::constructInWrapper):
+        Add a helper which does a forwarding placement-new into the API::Object of the passed in wrapper, after which it sets up m_wrapper.
+
+        (API::TypedObject::operator new):
+        Add a operator new to for placement-new. Also make TypedObject friends with Object so that constructInWrapper can call this.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        Add support for WKBrowsingContextGroup.
+
+        * UIProcess/API/mac/WKBrowsingContextGroup.mm:
+        (-[WKBrowsingContextGroup API::]):
+        (-[WKBrowsingContextGroup dealloc]):
+        (-[WKBrowsingContextGroup initWithIdentifier:]):
+        (-[WKBrowsingContextGroup allowsJavaScript]):
+        (-[WKBrowsingContextGroup setAllowsJavaScript:]):
+        (-[WKBrowsingContextGroup allowsJavaScriptMarkup]):
+        (-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]):
+        (-[WKBrowsingContextGroup allowsPlugIns]):
+        (-[WKBrowsingContextGroup setAllowsPlugIns:]):
+        (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]):
+        (-[WKBrowsingContextGroup removeAllUserStyleSheets]):
+        (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]):
+        (-[WKBrowsingContextGroup removeAllUserScripts]):
+        (-[WKBrowsingContextGroup _pageGroupRef]):
+        Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline (modeled on WKBackForwardList).
+
+        * UIProcess/API/mac/WKBrowsingContextGroupInternal.h: Added.
+        (WebKit::wrapper):
+        Add wrapper() helper and declare conformance to the WKObject protocol.
+
+        * UIProcess/WebPageGroup.cpp:
+        (WebKit::WebPageGroup::create):
+        (WebKit::WebPageGroup::WebPageGroup):
+        * UIProcess/WebPageGroup.h:
+        Make the WebPageGroup constructor public (for use with Object::constructInWrapper) and move being set in the webPageGroupMap()
+        to the constructor.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new file.
+
</ins><span class="cx"> 2013-11-27  Nick Diego Yamane  &lt;nick.yamane@openbossa.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove Qt-specific .qrc files
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIObject.h (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIObject.h        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/Shared/APIObject.h        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -30,7 +30,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include &quot;WKFoundation.h&quot;
</span><ins>+#ifdef __OBJC__
+#include &quot;WKObject.h&quot;
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #define DELEGATE_REF_COUNTING_TO_COCOA (PLATFORM(MAC) &amp;&amp; WK_API_ENABLED)
</span><span class="cx"> 
</span><span class="lines">@@ -165,6 +168,15 @@
</span><span class="cx">     virtual Type type() const = 0;
</span><span class="cx"> 
</span><span class="cx"> #if DELEGATE_REF_COUNTING_TO_COCOA
</span><ins>+#ifdef __OBJC__
+    template&lt;typename T, typename... Args&gt;
+    static void constructInWrapper(NSObject &lt;WKObject&gt; *wrapper, Args&amp;&amp;... args)
+    {
+        Object* object = new (&amp;wrapper._apiObject) T(std::forward&lt;Args&gt;(args)...);
+        object-&gt;m_wrapper = wrapper;
+    }
+#endif
+
</ins><span class="cx">     NSObject *wrapper() { return m_wrapper; }
</span><span class="cx"> 
</span><span class="cx">     void ref();
</span><span class="lines">@@ -195,6 +207,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><ins>+    friend Object;
+
</ins><span class="cx">     TypedObject()
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -203,6 +217,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if DELEGATE_REF_COUNTING_TO_COCOA
</span><span class="cx">     void* operator new(size_t size) { return newObject(size, APIType); }
</span><ins>+    void* operator new(size_t size, void* value) { return value; }
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WKBackForwardListInternal.h&quot;
</span><span class="cx"> #import &quot;WKBackForwardListItemInternal.h&quot;
</span><ins>+#import &quot;WKBrowsingContextGroupInternal.h&quot;
</ins><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKNSDictionary.h&quot;
</span><span class="cx"> #import &quot;WKNSError.h&quot;
</span><span class="lines">@@ -82,6 +83,10 @@
</span><span class="cx">         wrapper = [WKNavigationData alloc];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case Type::PageGroup:
+        wrapper = [WKBrowsingContextGroup alloc];
+        break;
+
</ins><span class="cx">     case Type::String:
</span><span class="cx">         wrapper = NSAllocateObject([WKNSString class], size, nullptr);
</span><span class="cx">         break;
</span><span class="lines">@@ -95,11 +100,12 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Object* object = &amp;wrapper._apiObject;
-    object-&gt;m_wrapper = wrapper;
-    return object;
</del><ins>+    Object&amp; object = wrapper._apiObject;
+    object.m_wrapper = wrapper;
+
+    return &amp;object;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-} // namespace WebKit
</del><ins>+} // namespace API
</ins><span class="cx"> 
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKBrowsingContextGroupmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #import &quot;config.h&quot;
</span><ins>+#import &quot;WKBrowsingContextGroupInternal.h&quot;
</ins><span class="cx"> #import &quot;WKBrowsingContextGroupPrivate.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="lines">@@ -43,54 +44,61 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><span class="cx"> @implementation WKBrowsingContextGroup {
</span><del>-    WKRetainPtr&lt;WKPageGroupRef&gt; _pageGroupRef;
</del><ins>+    std::aligned_storage&lt;sizeof(WebPageGroup), std::alignment_of&lt;WebPageGroup&gt;::value&gt;::type _pageGroup;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)dealloc
+{
+    reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)-&gt;~WebPageGroup();
+
+    [super dealloc];
+}
+
</ins><span class="cx"> - (id)initWithIdentifier:(NSString *)identifier
</span><span class="cx"> {
</span><span class="cx">     self = [super init];
</span><span class="cx">     if (!self)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    _pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(adoptWK(WKStringCreateWithCFString((CFStringRef)identifier)).get()));
</del><ins>+    API::Object::constructInWrapper&lt;WebPageGroup&gt;(self, identifier);
</ins><span class="cx"> 
</span><span class="cx">     // Give the WKBrowsingContextGroup a identifier-less preferences, so that they
</span><span class="cx">     // don't get automatically written to the disk. The automatic writing has proven
</span><span class="cx">     // confusing to users of the API.
</span><span class="cx">     WKRetainPtr&lt;WKPreferencesRef&gt; preferences = adoptWK(WKPreferencesCreate());
</span><del>-    WKPageGroupSetPreferences(_pageGroupRef.get(), preferences.get());
</del><ins>+    WKPageGroupSetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)), preferences.get());
</ins><span class="cx"> 
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)allowsJavaScript
</span><span class="cx"> {
</span><del>-    return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
</del><ins>+    return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setAllowsJavaScript:(BOOL)allowsJavaScript
</span><span class="cx"> {
</span><del>-    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsJavaScript);
</del><ins>+    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))), allowsJavaScript);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)allowsJavaScriptMarkup
</span><span class="cx"> {
</span><del>-    return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
</del><ins>+    return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
</span><span class="cx"> {
</span><del>-    WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsJavaScriptMarkup);
</del><ins>+    WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))), allowsJavaScriptMarkup);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)allowsPlugIns
</span><span class="cx"> {
</span><del>-    return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
</del><ins>+    return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setAllowsPlugIns:(BOOL)allowsPlugIns
</span><span class="cx"> {
</span><del>-    WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsPlugIns);
</del><ins>+    WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup))), allowsPlugIns);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static WKRetainPtr&lt;WKArrayRef&gt; createWKArray(NSArray *array)
</span><span class="lines">@@ -122,12 +130,12 @@
</span><span class="cx">     auto wkBlacklist = createWKArray(blacklist);
</span><span class="cx">     WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
</span><span class="cx"> 
</span><del>-    WKPageGroupAddUserStyleSheet(_pageGroupRef.get(), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
</del><ins>+    WKPageGroupAddUserStyleSheet(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)removeAllUserStyleSheets
</span><span class="cx"> {
</span><del>-    WKPageGroupRemoveAllUserStyleSheets(_pageGroupRef.get());
</del><ins>+    WKPageGroupRemoveAllUserStyleSheets(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)addUserScript:(NSString *)source baseURL:(NSURL *)baseURL whitelistedURLPatterns:(NSArray *)whitelist blacklistedURLPatterns:(NSArray *)blacklist injectionTime:(WKUserScriptInjectionTime)injectionTime mainFrameOnly:(BOOL)mainFrameOnly
</span><span class="lines">@@ -141,21 +149,28 @@
</span><span class="cx">     auto wkBlacklist = createWKArray(blacklist);
</span><span class="cx">     WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
</span><span class="cx"> 
</span><del>-    WKPageGroupAddUserScript(_pageGroupRef.get(), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
</del><ins>+    WKPageGroupAddUserScript(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)removeAllUserScripts
</span><span class="cx"> {
</span><del>-    WKPageGroupRemoveAllUserScripts(_pageGroupRef.get());
</del><ins>+    WKPageGroupRemoveAllUserScripts(toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark WKObject protocol implementation
+
+- (API::Object&amp;)_apiObject
+{
+    return *reinterpret_cast&lt;API::Object*&gt;(&amp;_pageGroup);
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKBrowsingContextGroup (Private)
</span><span class="cx"> 
</span><span class="cx"> - (WKPageGroupRef)_pageGroupRef
</span><span class="cx"> {
</span><del>-    return _pageGroupRef.get();
</del><ins>+    return toAPI(reinterpret_cast&lt;WebPageGroup*&gt;(&amp;_pageGroup));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKBrowsingContextGroupInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroupInternal.h (0 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroupInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroupInternal.h        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * 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 &quot;WKBrowsingContextGroup.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;WKObject.h&quot;
+#import &quot;WebPageGroup.h&quot;
+
+namespace WebKit {
+
+inline WKBrowsingContextGroup *wrapper(WebPageGroup&amp; pageGroup)
+{
+    ASSERT([pageGroup.wrapper() isKindOfClass:[WKBrowsingContextGroup class]]);
+    return (WKBrowsingContextGroup *)pageGroup.wrapper();
+}
+
+}
+
+@interface WKBrowsingContextGroup () &lt;WKObject&gt;
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -51,11 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;WebPageGroup&gt; WebPageGroup::create(const String&amp; identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;WebPageGroup&gt; pageGroup = adoptRef(new WebPageGroup(identifier, visibleToInjectedBundle, visibleToHistoryClient));
-
-    webPageGroupMap().set(pageGroup-&gt;pageGroupID(), pageGroup.get());
-
-    return pageGroup.release();
</del><ins>+    return adoptRef(new WebPageGroup(identifier, visibleToInjectedBundle, visibleToHistoryClient));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebPageGroup* WebPageGroup::get(uint64_t pageGroupID)
</span><span class="lines">@@ -74,6 +70,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_data.visibleToInjectedBundle = visibleToInjectedBundle;
</span><span class="cx">     m_data.visibleToHistoryClient = visibleToHistoryClient;
</span><ins>+    
+    webPageGroupMap().set(m_data.pageGroupID, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebPageGroup::~WebPageGroup()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageGrouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> class WebPageGroup : public API::TypedObject&lt;API::Object::Type::PageGroup&gt; {
</span><span class="cx"> public:
</span><ins>+    WebPageGroup(const String&amp; identifier = String(), bool visibleToInjectedBundle = true, bool visibleToHistoryClient = true);
</ins><span class="cx">     static PassRefPtr&lt;WebPageGroup&gt; create(const String&amp; identifier = String(), bool visibleToInjectedBundle = true, bool visibleToHistoryClient = true);
</span><span class="cx">     static WebPageGroup* get(uint64_t pageGroupID);
</span><span class="cx"> 
</span><span class="lines">@@ -64,8 +65,6 @@
</span><span class="cx">     void removeAllUserContent();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    WebPageGroup(const String&amp; identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient);
-
</del><span class="cx">     template&lt;typename T&gt; void sendToAllProcessesInGroup(const T&amp;, uint64_t destinationID);
</span><span class="cx"> 
</span><span class="cx">     WebPageGroupData m_data;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (159823 => 159824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-11-27 21:03:51 UTC (rev 159823)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-11-27 22:48:32 UTC (rev 159824)
</span><span class="lines">@@ -691,6 +691,7 @@
</span><span class="cx">                 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
</span><span class="cx">                 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
</span><span class="cx">                 7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; };
</span><ins>+                7C9D1537184584DA009D3918 /* WKBrowsingContextGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */; };
</ins><span class="cx">                 7CA254EB182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 7CB16FEF1724BA23007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE21724B9B5007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb */; };
</span><span class="cx">                 7CB16FF01724BA24007A0A95 /* com.apple.QuickTime Plugin.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE31724B9B5007A0A95 /* com.apple.QuickTime Plugin.plugin.sb */; };
</span><span class="lines">@@ -2241,6 +2242,7 @@
</span><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageBannerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextGroupInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextPolicyDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CB16FE21724B9B5007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.ist.ds.appleconnect.webplugin.sb; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CB16FE31724B9B5007A0A95 /* com.apple.QuickTime Plugin.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = &quot;com.apple.QuickTime Plugin.plugin.sb&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4640,6 +4642,7 @@
</span><span class="cx">                                 3788A05B14743C90006319E5 /* WKBrowsingContextControllerPrivate.h */,
</span><span class="cx">                                 BCBAACEE145232430053F82F /* WKBrowsingContextGroup.h */,
</span><span class="cx">                                 BCBAACEF145232440053F82F /* WKBrowsingContextGroup.mm */,
</span><ins>+                                7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */,
</ins><span class="cx">                                 BCBAACF0145232480053F82F /* WKBrowsingContextGroupPrivate.h */,
</span><span class="cx">                                 BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */,
</span><span class="cx">                                 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */,
</span><span class="lines">@@ -6078,6 +6081,7 @@
</span><span class="cx">                                 F67DD7BA125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h in Headers */,
</span><span class="cx">                                 BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */,
</span><span class="cx">                                 BC407606124FF0270068F20A /* WKString.h in Headers */,
</span><ins>+                                7C9D1537184584DA009D3918 /* WKBrowsingContextGroupInternal.h in Headers */,
</ins><span class="cx">                                 BC40761A124FF0370068F20A /* WKStringCF.h in Headers */,
</span><span class="cx">                                 759CCD591808F1690078E8A8 /* WebOriginDataManagerProxyChangeClient.h in Headers */,
</span><span class="cx">                                 BC9099801256A98200083756 /* WKStringPrivate.h in Headers */,
</span></span></pre>
</div>
</div>

</body>
</html>