<!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>[159603] 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/159603">159603</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2013-11-20 20:09:24 -0800 (Wed, 20 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebPageGroup's should keep track of what processes they are being used by
https://bugs.webkit.org/show_bug.cgi?id=124556

Reviewed by Dan Bernstein.

* Scripts/webkit2/messages.py:
(struct_or_class):
Mark WebPageGroupData as a struct.

* Shared/UserMessageCoders.h:
* Shared/mac/ObjCObjectGraphCoders.h:
* Shared/mac/ObjCObjectGraphCoders.mm:
* WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
* UIProcess/WebConnectionToWebProcess.cpp:
* UIProcess/WebContext.cpp:
* UIProcess/WebContextUserMessageCoders.h:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
Pass the WebProcess/WebProcessProxy to both encode and decode.

* Shared/WebPageCreationParameters.h:
Pass the page group by ID when creating a page, as it will have had its own
creation message sent already.

* UIProcess/WebPageGroup.cpp:
* UIProcess/WebPageGroup.h:
Keep track of processes.

* UIProcess/WebProcessProxy.cpp:
* UIProcess/WebProcessProxy.h:
Keep track of the page groups used by the process.

* WebProcess/WebPage/WebPage.cpp:
Get the already created page group on creation.

* WebProcess/WebProcess.cpp:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
Explicitly create page groups in the WebProcess.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2Scriptswebkit2messagespy">trunk/Source/WebKit2/Scripts/webkit2/messages.py</a></li>
<li><a href="#trunkSourceWebKit2SharedUserMessageCodersh">trunk/Source/WebKit2/Shared/UserMessageCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPageCreationParameterscpp">trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPageCreationParametersh">trunk/Source/WebKit2/Shared/WebPageCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacObjCObjectGraphCodersh">trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacObjCObjectGraphCodersmm">trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebConnectionToWebProcesscpp">trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebContextcpp">trunk/Source/WebKit2/UIProcess/WebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebContextUserMessageCodersh">trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h</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="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxyh">trunk/Source/WebKit2/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleUserMessageCodersh">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessmessagesin">trunk/Source/WebKit2/WebProcess/WebProcess.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/ChangeLog        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2013-11-18  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        WebPageGroup's should keep track of what processes they are being used by
+        https://bugs.webkit.org/show_bug.cgi?id=124556
+
+        Reviewed by Dan Bernstein.
+
+        * Scripts/webkit2/messages.py:
+        (struct_or_class):
+        Mark WebPageGroupData as a struct.
+
+        * Shared/UserMessageCoders.h:
+        * Shared/mac/ObjCObjectGraphCoders.h:
+        * Shared/mac/ObjCObjectGraphCoders.mm:
+        * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
+        * UIProcess/WebConnectionToWebProcess.cpp:
+        * UIProcess/WebContext.cpp:
+        * UIProcess/WebContextUserMessageCoders.h:
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        Pass the WebProcess/WebProcessProxy to both encode and decode.
+
+        * Shared/WebPageCreationParameters.h:
+        Pass the page group by ID when creating a page, as it will have had its own
+        creation message sent already.
+
+        * UIProcess/WebPageGroup.cpp:
+        * UIProcess/WebPageGroup.h:
+        Keep track of processes.
+
+        * UIProcess/WebProcessProxy.cpp:
+        * UIProcess/WebProcessProxy.h:
+        Keep track of the page groups used by the process.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        Get the already created page group on creation.
+
+        * WebProcess/WebProcess.cpp:
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+        Explicitly create page groups in the WebProcess.
+
</ins><span class="cx"> 2013-11-20  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IDB related cleanup in WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKit2Scriptswebkit2messagespy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Scripts/webkit2/messages.py        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -213,6 +213,7 @@
</span><span class="cx">         'WebKit::TextCheckerState',
</span><span class="cx">         'WebKit::WebNavigationDataStore',
</span><span class="cx">         'WebKit::WebPageCreationParameters',
</span><ins>+        'WebKit::WebPageGroupData',
</ins><span class="cx">         'WebKit::WebPreferencesStore',
</span><span class="cx">         'WebKit::WebProcessCreationParameters',
</span><span class="cx">         'WebKit::WindowGeometry',
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedUserMessageCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/UserMessageCoders.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/UserMessageCoders.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Shared/UserMessageCoders.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> template&lt;typename Owner&gt;
</span><span class="cx"> class UserMessageEncoder {
</span><span class="cx"> public:
</span><del>-    bool baseEncode(CoreIPC::ArgumentEncoder&amp; encoder, API::Object::Type&amp; type) const
</del><ins>+    bool baseEncode(CoreIPC::ArgumentEncoder&amp; encoder, const Owner&amp; coder, API::Object::Type&amp; type) const
</ins><span class="cx">     {
</span><span class="cx">         if (!m_root) {
</span><span class="cx">             encoder &lt;&lt; static_cast&lt;uint32_t&gt;(API::Object::Type::Null);
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">             API::Array* array = static_cast&lt;API::Array*&gt;(m_root);
</span><span class="cx">             encoder &lt;&lt; static_cast&lt;uint64_t&gt;(array-&gt;size());
</span><span class="cx">             for (size_t i = 0; i &lt; array-&gt;size(); ++i)
</span><del>-                encoder &lt;&lt; Owner(array-&gt;at(i));
</del><ins>+                encoder &lt;&lt; Owner(coder, array-&gt;at(i));
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::Dictionary: {
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">             ImmutableDictionary::MapType::const_iterator end = map.end();
</span><span class="cx">             for (; it != end; ++it) {
</span><span class="cx">                 encoder &lt;&lt; it-&gt;key;
</span><del>-                encoder &lt;&lt; Owner(it-&gt;value.get());
</del><ins>+                encoder &lt;&lt; Owner(coder, it-&gt;value.get());
</ins><span class="cx">             }
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="lines">@@ -149,15 +149,15 @@
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::RenderLayer: {
</span><span class="cx">             WebRenderLayer* renderLayer = static_cast&lt;WebRenderLayer*&gt;(m_root);
</span><del>-            encoder &lt;&lt; Owner(renderLayer-&gt;renderer());
</del><ins>+            encoder &lt;&lt; Owner(coder, renderLayer-&gt;renderer());
</ins><span class="cx">             encoder &lt;&lt; renderLayer-&gt;isReflection();
</span><span class="cx">             encoder &lt;&lt; renderLayer-&gt;isClipping();
</span><span class="cx">             encoder &lt;&lt; renderLayer-&gt;isClipped();
</span><span class="cx">             encoder &lt;&lt; static_cast&lt;uint32_t&gt;(renderLayer-&gt;compositingLayerType());
</span><span class="cx">             encoder &lt;&lt; renderLayer-&gt;absoluteBoundingBox();
</span><del>-            encoder &lt;&lt; Owner(renderLayer-&gt;negativeZOrderList());
-            encoder &lt;&lt; Owner(renderLayer-&gt;normalFlowList());
-            encoder &lt;&lt; Owner(renderLayer-&gt;positiveZOrderList());
</del><ins>+            encoder &lt;&lt; Owner(coder, renderLayer-&gt;negativeZOrderList());
+            encoder &lt;&lt; Owner(coder, renderLayer-&gt;normalFlowList());
+            encoder &lt;&lt; Owner(coder, renderLayer-&gt;positiveZOrderList());
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::RenderObject: {
</span><span class="lines">@@ -165,10 +165,10 @@
</span><span class="cx">             encoder &lt;&lt; renderObject-&gt;name();
</span><span class="cx">             encoder &lt;&lt; renderObject-&gt;elementTagName();
</span><span class="cx">             encoder &lt;&lt; renderObject-&gt;elementID();
</span><del>-            encoder &lt;&lt; Owner(renderObject-&gt;elementClassNames());
</del><ins>+            encoder &lt;&lt; Owner(coder, renderObject-&gt;elementClassNames());
</ins><span class="cx">             encoder &lt;&lt; renderObject-&gt;absolutePosition();
</span><span class="cx">             encoder &lt;&lt; renderObject-&gt;frameRect();
</span><del>-            encoder &lt;&lt; Owner(renderObject-&gt;children());
</del><ins>+            encoder &lt;&lt; Owner(coder, renderObject-&gt;children());
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::URL: {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPageCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx">     encoder &lt;&lt; store;
</span><span class="cx">     encoder.encodeEnum(drawingAreaType);
</span><del>-    encoder &lt;&lt; pageGroupData;
</del><ins>+    encoder &lt;&lt; pageGroupID;
</ins><span class="cx">     encoder &lt;&lt; drawsBackground;
</span><span class="cx">     encoder &lt;&lt; drawsTransparentBackground;
</span><span class="cx">     encoder &lt;&lt; underlayColor;
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decodeEnum(parameters.drawingAreaType))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(parameters.pageGroupData))
</del><ins>+    if (!decoder.decode(parameters.pageGroupID))
</ins><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.drawsBackground))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPageCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     
</span><span class="cx">     WebPreferencesStore store;
</span><span class="cx">     DrawingAreaType drawingAreaType;
</span><del>-    WebPageGroupData pageGroupData;
</del><ins>+    uint64_t pageGroupID;
</ins><span class="cx"> 
</span><span class="cx">     bool drawsBackground;
</span><span class="cx">     bool drawsTransparentBackground;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacObjCObjectGraphCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -38,11 +38,12 @@
</span><span class="cx"> 
</span><span class="cx"> class WebContextObjCObjectGraphEncoder {
</span><span class="cx"> public:
</span><del>-    explicit WebContextObjCObjectGraphEncoder(ObjCObjectGraph*);
</del><ins>+    explicit WebContextObjCObjectGraphEncoder(ObjCObjectGraph*, WebProcessProxy*);
</ins><span class="cx">     void encode(CoreIPC::ArgumentEncoder&amp;) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ObjCObjectGraph* m_objectGraph;
</span><ins>+    WebProcessProxy* m_process;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class WebContextObjCObjectGraphDecoder {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacObjCObjectGraphCodersmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> template&lt;typename Owner&gt;
</span><span class="cx"> class ObjCObjectGraphEncoder {
</span><span class="cx"> public:
</span><del>-    bool baseEncode(CoreIPC::ArgumentEncoder&amp; encoder, WebKitNSType&amp; type) const
</del><ins>+    bool baseEncode(CoreIPC::ArgumentEncoder&amp; encoder, const Owner&amp; coder, WebKitNSType&amp; type) const
</ins><span class="cx">     {
</span><span class="cx">         if (!m_root) {
</span><span class="cx">             encoder &lt;&lt; static_cast&lt;uint32_t&gt;(NullType);
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">             encoder &lt;&lt; static_cast&lt;uint64_t&gt;(size);
</span><span class="cx"> 
</span><span class="cx">             for (NSUInteger i = 0; i &lt; size; ++i)
</span><del>-                encoder &lt;&lt; Owner([array objectAtIndex:i]);
</del><ins>+                encoder &lt;&lt; Owner(coder, [array objectAtIndex:i]);
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">         case NSDictionaryType: {
</span><span class="lines">@@ -130,8 +130,8 @@
</span><span class="cx">             NSArray *keys = [dictionary allKeys];
</span><span class="cx">             NSArray *values = [dictionary allValues];
</span><span class="cx">             for (NSUInteger i = 0; i &lt; size; ++i) {
</span><del>-                encoder &lt;&lt; Owner([keys objectAtIndex:i]);
-                encoder &lt;&lt; Owner([values objectAtIndex:i]);
</del><ins>+                encoder &lt;&lt; Owner(coder, [keys objectAtIndex:i]);
+                encoder &lt;&lt; Owner(coder, [values objectAtIndex:i]);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             return true;
</span><span class="lines">@@ -269,15 +269,22 @@
</span><span class="cx"> public:
</span><span class="cx">     typedef ObjCObjectGraphEncoder&lt;WebContextObjCObjectGraphEncoderImpl&gt; Base;
</span><span class="cx"> 
</span><del>-    explicit WebContextObjCObjectGraphEncoderImpl(id root)
</del><ins>+    explicit WebContextObjCObjectGraphEncoderImpl(id root, WebProcessProxy* process)
</ins><span class="cx">         : Base(root)
</span><ins>+        , m_process(process)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    WebContextObjCObjectGraphEncoderImpl(const WebContextObjCObjectGraphEncoderImpl&amp; userMessageEncoder, id root)
+        : Base(root)
+        , m_process(userMessageEncoder.m_process)
+    {
+    }
+
</ins><span class="cx">     void encode(CoreIPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx">     {
</span><span class="cx">         WebKitNSType type = NullType;
</span><del>-        if (baseEncode(encoder, type))
</del><ins>+        if (baseEncode(encoder, *this, type))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -290,7 +297,7 @@
</span><span class="cx">         }
</span><span class="cx">         case WKTypeRefWrapperType: {
</span><span class="cx">             WKTypeRefWrapper *wrapper = static_cast&lt;WKTypeRefWrapper *&gt;(m_root);
</span><del>-            encoder &lt;&lt; WebContextUserMessageEncoder(toImpl(wrapper.object));
</del><ins>+            encoder &lt;&lt; WebContextUserMessageEncoder(toImpl(wrapper.object), m_process);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="lines">@@ -299,6 +306,9 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
+private:
+    WebProcessProxy* m_process;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -378,10 +388,15 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    explicit InjectedBundleObjCObjectGraphEncoderImpl(const InjectedBundleObjCObjectGraphEncoderImpl&amp;, id root)
+        : Base(root)
+    {
+    }
+
</ins><span class="cx">     void encode(CoreIPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx">     {
</span><span class="cx">         WebKitNSType type = NullType;
</span><del>-        if (baseEncode(encoder, type))
</del><ins>+        if (baseEncode(encoder, *this, type))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -471,14 +486,15 @@
</span><span class="cx"> 
</span><span class="cx"> // Adaptors
</span><span class="cx"> 
</span><del>-WebContextObjCObjectGraphEncoder::WebContextObjCObjectGraphEncoder(ObjCObjectGraph* objectGraph)
</del><ins>+WebContextObjCObjectGraphEncoder::WebContextObjCObjectGraphEncoder(ObjCObjectGraph* objectGraph, WebProcessProxy* process)
</ins><span class="cx">     : m_objectGraph(objectGraph)
</span><ins>+    , m_process(process)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebContextObjCObjectGraphEncoder::encode(CoreIPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx"> {
</span><del>-    encoder &lt;&lt; WebContextObjCObjectGraphEncoderImpl(m_objectGraph-&gt;rootObject());
</del><ins>+    encoder &lt;&lt; WebContextObjCObjectGraphEncoderImpl(m_objectGraph-&gt;rootObject(), m_process);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebContextObjCObjectGraphDecoder::WebContextObjCObjectGraphDecoder(RefPtr&lt;ObjCObjectGraph&gt;&amp; objectGraph, WebProcessProxy* process)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebConnectionToWebProcess::encodeMessageBody(CoreIPC::ArgumentEncoder&amp; encoder, API::Object* messageBody)
</span><span class="cx"> {
</span><del>-    encoder &lt;&lt; WebContextUserMessageEncoder(messageBody);
</del><ins>+    encoder &lt;&lt; WebContextUserMessageEncoder(messageBody, m_process);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebConnectionToWebProcess::decodeMessageBody(CoreIPC::ArgumentDecoder&amp; decoder, RefPtr&lt;API::Object&gt;&amp; messageBody)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebContext.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -573,7 +573,7 @@
</span><span class="cx">     RefPtr&lt;API::Object&gt; injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this);
</span><span class="cx">     if (!injectedBundleInitializationUserData)
</span><span class="cx">         injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
</span><del>-    process-&gt;send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0);
</del><ins>+    process-&gt;send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get(), process.get())), 0);
</ins><span class="cx"> 
</span><span class="cx">     if (WebPreferences::anyPageGroupsAreUsingPrivateBrowsing())
</span><span class="cx">         process-&gt;send(Messages::WebProcess::EnsurePrivateBrowsingSession(), 0);
</span><span class="lines">@@ -587,7 +587,7 @@
</span><span class="cx">             CoreIPC::ArgumentEncoder messageData;
</span><span class="cx"> 
</span><span class="cx">             messageData.encode(message.first);
</span><del>-            messageData.encode(WebContextUserMessageEncoder(message.second.get()));
</del><ins>+            messageData.encode(WebContextUserMessageEncoder(message.second.get(), process.get()));
</ins><span class="cx">             process-&gt;send(Messages::WebProcess::PostInjectedBundleMessage(CoreIPC::DataReference(messageData.buffer(), messageData.bufferSize())), 0);
</span><span class="cx">         }
</span><span class="cx">         m_messagesToInjectedBundlePostedToEmptyContext.clear();
</span><span class="lines">@@ -738,7 +738,7 @@
</span><span class="cx">     if (!pageGroup)
</span><span class="cx">         pageGroup = m_defaultPageGroup.get();
</span><span class="cx"> 
</span><del>-    return process-&gt;createWebPage(pageClient, this, pageGroup);
</del><ins>+    return process-&gt;createWebPage(pageClient, *pageGroup);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest&amp; request)
</span><span class="lines">@@ -768,12 +768,13 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process.
</span><span class="cx"> 
</span><del>-    CoreIPC::ArgumentEncoder messageData;
-    messageData.encode(messageName);
-    messageData.encode(WebContextUserMessageEncoder(messageBody));
</del><ins>+    for (size_t i = 0; i &lt; m_processes.size(); ++i) {
+        CoreIPC::ArgumentEncoder messageData;
+        messageData.encode(messageName);
+        messageData.encode(WebContextUserMessageEncoder(messageBody, m_processes[i].get()));
</ins><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; m_processes.size(); ++i)
</del><span class="cx">         m_processes[i]-&gt;send(Messages::WebProcess::PostInjectedBundleMessage(CoreIPC::DataReference(messageData.buffer(), messageData.bufferSize())), 0);
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // InjectedBundle client
</span><span class="lines">@@ -971,7 +972,7 @@
</span><span class="cx"> 
</span><span class="cx">         RefPtr&lt;API::Object&gt; returnData;
</span><span class="cx">         didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody.get(), returnData);
</span><del>-        replyEncoder-&gt;encode(WebContextUserMessageEncoder(returnData.get()));
</del><ins>+        replyEncoder-&gt;encode(WebContextUserMessageEncoder(returnData.get(), WebProcessProxy::fromConnection(connection)));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebContextUserMessageCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -45,15 +45,22 @@
</span><span class="cx"> public:
</span><span class="cx">     typedef UserMessageEncoder&lt;WebContextUserMessageEncoder&gt; Base;
</span><span class="cx"> 
</span><del>-    explicit WebContextUserMessageEncoder(API::Object* root) 
</del><ins>+    explicit WebContextUserMessageEncoder(API::Object* root, WebProcessProxy* process)
</ins><span class="cx">         : Base(root)
</span><ins>+        , m_process(process)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    WebContextUserMessageEncoder(const WebContextUserMessageEncoder&amp; userMessageEncoder, API::Object* root)
+        : Base(root)
+        , m_process(userMessageEncoder.m_process)
+    {
+    }
+
</ins><span class="cx">     void encode(CoreIPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx">     {
</span><span class="cx">         API::Object::Type type = API::Object::Type::Null;
</span><del>-        if (baseEncode(encoder, type))
</del><ins>+        if (baseEncode(encoder, *this, type))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -69,13 +76,21 @@
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::PageGroup: {
</span><span class="cx">             WebPageGroup* pageGroup = static_cast&lt;WebPageGroup*&gt;(m_root);
</span><del>-            encoder &lt;&lt; pageGroup-&gt;data();
</del><ins>+            if (pageGroup-&gt;addProcess(*m_process)) {
+                m_process-&gt;addWebPageGroup(*pageGroup);
+            
+                encoder &lt;&lt; true;
+                encoder &lt;&lt; pageGroup-&gt;data();
+            } else {
+                encoder &lt;&lt; false;
+                encoder &lt;&lt; pageGroup-&gt;pageGroupID();
+            }
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">         case API::Object::Type::ObjCObjectGraph: {
</span><span class="cx">             ObjCObjectGraph* objectGraph = static_cast&lt;ObjCObjectGraph*&gt;(m_root);
</span><del>-            encoder &lt;&lt; WebContextObjCObjectGraphEncoder(objectGraph);
</del><ins>+            encoder &lt;&lt; WebContextObjCObjectGraphEncoder(objectGraph, m_process);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="lines">@@ -84,6 +99,9 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
+private:
+    WebProcessProxy* m_process;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // Adds
</span><span class="lines">@@ -135,7 +153,7 @@
</span><span class="cx">             uint64_t pageGroupID;
</span><span class="cx">             if (!decoder.decode(pageGroupID))
</span><span class="cx">                 return false;
</span><del>-            coder.m_root = WebPageGroup::get(pageGroupID);
</del><ins>+            coder.m_root = coder.m_process-&gt;webPageGroup(pageGroupID);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;WebPageGroupProxyMessages.h&quot;
</span><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><span class="cx"> #include &quot;WebPreferences.h&quot;
</span><ins>+#include &quot;WebProcessMessages.h&quot;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringConcatenate.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -191,4 +192,14 @@
</span><span class="cx">     sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserContent(), m_data.pageGroupID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebPageGroup::addProcess(WebProcessProxy&amp; process)
+{
+    return m_processes.add(&amp;process).isNewEntry;
+}
+
+void WebPageGroup::disconnectProcess(WebProcessProxy&amp; process)
+{
+    m_processes.remove(&amp;process);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageGrouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -35,8 +35,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-class WebPreferences;
</del><span class="cx"> class WebPageProxy;
</span><ins>+class WebPreferences;
</ins><span class="cx"> 
</span><span class="cx"> class WebPageGroup : public API::TypedObject&lt;API::Object::Type::PageGroup&gt; {
</span><span class="cx"> public:
</span><span class="lines">@@ -56,13 +56,16 @@
</span><span class="cx">     void setPreferences(WebPreferences*);
</span><span class="cx">     WebPreferences* preferences() const;
</span><span class="cx">     void preferencesDidChange();
</span><del>-    
</del><ins>+
</ins><span class="cx">     void addUserStyleSheet(const String&amp; source, const String&amp; baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserStyleLevel);
</span><span class="cx">     void addUserScript(const String&amp; source, const String&amp; baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
</span><span class="cx">     void removeAllUserStyleSheets();
</span><span class="cx">     void removeAllUserScripts();
</span><span class="cx">     void removeAllUserContent();
</span><span class="cx"> 
</span><ins>+    bool addProcess(WebProcessProxy&amp;);
+    void disconnectProcess(WebProcessProxy&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageGroup(const String&amp; identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient);
</span><span class="cx"> 
</span><span class="lines">@@ -71,20 +74,13 @@
</span><span class="cx">     WebPageGroupData m_data;
</span><span class="cx">     mutable RefPtr&lt;WebPreferences&gt; m_preferences;
</span><span class="cx">     HashSet&lt;WebPageProxy*&gt; m_pages;
</span><ins>+    HashSet&lt;WebProcessProxy*&gt; m_processes;
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> template&lt;typename T&gt;
</span><span class="cx"> void WebPageGroup::sendToAllProcessesInGroup(const T&amp; message, uint64_t destinationID)
</span><span class="cx"> {
</span><del>-    HashSet&lt;WebProcessProxy*&gt; processesSeen;
-
-    for (WebPageProxy* webPageProxy : m_pages) {
-        WebProcessProxy* webProcessProxy = webPageProxy-&gt;process();
-        ASSERT(webProcessProxy);
-
-        if (!processesSeen.add(webProcessProxy).isNewEntry)
-            continue;
-
</del><ins>+    for (auto webProcessProxy : m_processes) {
</ins><span class="cx">         if (webProcessProxy-&gt;canSendMessage())
</span><span class="cx">             webProcessProxy-&gt;send(T(message), destinationID);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -222,15 +222,15 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // !LOG_DISABLED
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageProxy&gt; WebPageProxy::create(PageClient* pageClient, PassRefPtr&lt;WebProcessProxy&gt; process, WebPageGroup* pageGroup, uint64_t pageID)
</del><ins>+PassRefPtr&lt;WebPageProxy&gt; WebPageProxy::create(PageClient* pageClient, PassRefPtr&lt;WebProcessProxy&gt; process, WebPageGroup&amp; pageGroup, uint64_t pageID)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr&lt;WebProcessProxy&gt; process, WebPageGroup* pageGroup, uint64_t pageID)
</del><ins>+WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr&lt;WebProcessProxy&gt; process, WebPageGroup&amp; pageGroup, uint64_t pageID)
</ins><span class="cx">     : m_pageClient(pageClient)
</span><span class="cx">     , m_process(process)
</span><del>-    , m_pageGroup(pageGroup)
</del><ins>+    , m_pageGroup(&amp;pageGroup)
</ins><span class="cx">     , m_mainFrame(0)
</span><span class="cx">     , m_userAgent(standardUserAgent())
</span><span class="cx">     , m_geolocationPermissionRequestManager(this)
</span><span class="lines">@@ -524,6 +524,11 @@
</span><span class="cx">         inspector()-&gt;enableRemoteInspection();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    if (m_pageGroup-&gt;addProcess(*m_process)) {
+        m_process-&gt;addWebPageGroup(*m_pageGroup);
+        m_process-&gt;send(Messages::WebProcess::CreateWebPageGroup(m_pageGroup-&gt;pageGroupID(), m_pageGroup-&gt;data()), 0);
+    }
+
</ins><span class="cx">     initializeCreationParameters();
</span><span class="cx">     m_process-&gt;send(Messages::WebProcess::CreateWebPage(m_pageID, m_creationParameters), 0);
</span><span class="cx"> 
</span><span class="lines">@@ -612,7 +617,7 @@
</span><span class="cx">     bool createdExtension = maybeInitializeSandboxExtensionHandle(URL(URL(), url), sandboxExtensionHandle);
</span><span class="cx">     if (createdExtension)
</span><span class="cx">         m_process-&gt;willAcquireUniversalFileReadSandboxExtension();
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -627,7 +632,7 @@
</span><span class="cx">     bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest-&gt;resourceRequest().url(), sandboxExtensionHandle);
</span><span class="cx">     if (createdExtension)
</span><span class="cx">         m_process-&gt;willAcquireUniversalFileReadSandboxExtension();
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadURLRequest(urlRequest-&gt;resourceRequest(), sandboxExtensionHandle, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadURLRequest(urlRequest-&gt;resourceRequest(), sandboxExtensionHandle, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -654,7 +659,7 @@
</span><span class="cx">     SandboxExtension::Handle sandboxExtensionHandle;
</span><span class="cx">     SandboxExtension::createHandle(resourceDirectoryPath, SandboxExtension::ReadOnly, sandboxExtensionHandle);
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(resourceDirectoryURL);
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadURL(fileURL, sandboxExtensionHandle, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadURL(fileURL, sandboxExtensionHandle, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -664,7 +669,7 @@
</span><span class="cx">         reattachToWebProcess();
</span><span class="cx"> 
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(baseURL);
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadData(data-&gt;dataReference(), MIMEType, encoding, baseURL, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadData(data-&gt;dataReference(), MIMEType, encoding, baseURL, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -674,7 +679,7 @@
</span><span class="cx">         reattachToWebProcess();
</span><span class="cx"> 
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(baseURL);
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadHTMLString(htmlString, baseURL, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadHTMLString(htmlString, baseURL, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -689,7 +694,7 @@
</span><span class="cx">         m_mainFrame-&gt;setUnreachableURL(unreachableURL);
</span><span class="cx"> 
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(baseURL);
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -698,7 +703,7 @@
</span><span class="cx">     if (!isValid())
</span><span class="cx">         reattachToWebProcess();
</span><span class="cx"> 
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadPlainTextString(string, WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadPlainTextString(string, WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -707,7 +712,7 @@
</span><span class="cx">     if (!isValid())
</span><span class="cx">         reattachToWebProcess();
</span><span class="cx"> 
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadWebArchiveData(webArchiveData-&gt;dataReference(), WebContextUserMessageEncoder(userData)), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadWebArchiveData(webArchiveData-&gt;dataReference(), WebContextUserMessageEncoder(userData, m_process.get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3105,7 +3110,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::postMessageToInjectedBundle(const String&amp; messageName, API::Object* messageBody)
</span><span class="cx"> {
</span><del>-    process()-&gt;send(Messages::WebPage::PostInjectedBundleMessage(messageName, WebContextUserMessageEncoder(messageBody)), m_pageID);
</del><ins>+    process()-&gt;send(Messages::WebPage::PostInjectedBundleMessage(messageName, WebContextUserMessageEncoder(messageBody, process())), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="lines">@@ -3862,7 +3867,7 @@
</span><span class="cx">     m_creationParameters.viewState = m_viewState;
</span><span class="cx">     m_creationParameters.drawingAreaType = m_drawingArea-&gt;type();
</span><span class="cx">     m_creationParameters.store = m_pageGroup-&gt;preferences()-&gt;store();
</span><del>-    m_creationParameters.pageGroupData = m_pageGroup-&gt;data();
</del><ins>+    m_creationParameters.pageGroupID = m_pageGroup-&gt;pageGroupID();
</ins><span class="cx">     m_creationParameters.drawsBackground = m_drawsBackground;
</span><span class="cx">     m_creationParameters.drawsTransparentBackground = m_drawsTransparentBackground;
</span><span class="cx">     m_creationParameters.underlayColor = m_underlayColor;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">     , public CoreIPC::MessageReceiver {
</span><span class="cx"> public:
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;WebPageProxy&gt; create(PageClient*, PassRefPtr&lt;WebProcessProxy&gt;, WebPageGroup*, uint64_t pageID);
</del><ins>+    static PassRefPtr&lt;WebPageProxy&gt; create(PageClient*, PassRefPtr&lt;WebProcessProxy&gt;, WebPageGroup&amp;, uint64_t pageID);
</ins><span class="cx">     virtual ~WebPageProxy();
</span><span class="cx"> 
</span><span class="cx">     uint64_t pageID() const { return m_pageID; }
</span><span class="lines">@@ -742,7 +742,7 @@
</span><span class="cx">     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
</span><span class="cx">         
</span><span class="cx"> private:
</span><del>-    WebPageProxy(PageClient*, PassRefPtr&lt;WebProcessProxy&gt;, WebPageGroup*, uint64_t pageID);
</del><ins>+    WebPageProxy(PageClient*, PassRefPtr&lt;WebProcessProxy&gt;, WebPageGroup&amp;, uint64_t pageID);
</ins><span class="cx">     void platformInitialize();
</span><span class="cx">     void initializeCreationParameters();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;WebContext.h&quot;
</span><span class="cx"> #include &quot;WebNavigationDataStore.h&quot;
</span><span class="cx"> #include &quot;WebNotificationManagerProxy.h&quot;
</span><ins>+#include &quot;WebPageGroup.h&quot;
</ins><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><span class="cx"> #include &quot;WebPluginSiteDataManager.h&quot;
</span><span class="cx"> #include &quot;WebProcessMessages.h&quot;
</span><span class="lines">@@ -152,6 +153,12 @@
</span><span class="cx">     if (m_downloadProxyMap)
</span><span class="cx">         m_downloadProxyMap-&gt;processDidClose();
</span><span class="cx"> 
</span><ins>+    Vector&lt;WebPageGroup*&gt; pageGroups;
+    copyValuesToVector(m_pageGroups, pageGroups);
+    for (size_t i = 0, size = frames.size(); i &lt; size; ++i)
+        pageGroups[i]-&gt;disconnectProcess(*this);
+    m_pageGroups.clear();
+
</ins><span class="cx">     m_context-&gt;disconnectProcess(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -160,7 +167,7 @@
</span><span class="cx">     return globalPageMap().get(pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageProxy&gt; WebProcessProxy::createWebPage(PageClient* pageClient, WebContext*, WebPageGroup* pageGroup)
</del><ins>+PassRefPtr&lt;WebPageProxy&gt; WebProcessProxy::createWebPage(PageClient* pageClient, WebPageGroup&amp; pageGroup)
</ins><span class="cx"> {
</span><span class="cx">     uint64_t pageID = generatePageID();
</span><span class="cx">     RefPtr&lt;WebPageProxy&gt; webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
</span><span class="lines">@@ -209,6 +216,19 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebPageGroup* WebProcessProxy::webPageGroup(uint64_t pageGroupID)
+{
+    if (!HashMap&lt;uint64_t, WebPageGroup*&gt;::isValidKey(pageGroupID))
+        return nullptr;
+
+    return m_pageGroups.get(pageGroupID);
+}
+
+void WebProcessProxy::addWebPageGroup(WebPageGroup&amp; pageGroup)
+{
+    m_pageGroups.add(pageGroup.pageGroupID(), &amp;pageGroup);
+}
+
</ins><span class="cx"> WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const
</span><span class="cx"> {
</span><span class="cx">     return m_backForwardListItemMap.get(itemID);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -77,11 +77,14 @@
</span><span class="cx">     WebContext* context() const { return m_context.get(); }
</span><span class="cx"> 
</span><span class="cx">     static WebPageProxy* webPage(uint64_t pageID);
</span><del>-    PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient*, WebContext*, WebPageGroup*);
</del><ins>+    PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient*, WebPageGroup&amp;);
</ins><span class="cx">     void addExistingWebPage(WebPageProxy*, uint64_t pageID);
</span><span class="cx">     void removeWebPage(uint64_t pageID);
</span><span class="cx">     Vector&lt;WebPageProxy*&gt; pages() const;
</span><span class="cx"> 
</span><ins>+    WebPageGroup* webPageGroup(uint64_t pageGroupID);
+    void addWebPageGroup(WebPageGroup&amp;);
+
</ins><span class="cx">     WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const;
</span><span class="cx"> 
</span><span class="cx">     ResponsivenessTimer* responsivenessTimer() { return &amp;m_responsivenessTimer; }
</span><span class="lines">@@ -194,6 +197,7 @@
</span><span class="cx">     WebPageProxyMap m_pageMap;
</span><span class="cx">     WebFrameProxyMap m_frameMap;
</span><span class="cx">     WebBackForwardListItemMap m_backForwardListItemMap;
</span><ins>+    HashMap&lt;uint64_t, WebPageGroup*&gt; m_pageGroups;
</ins><span class="cx"> 
</span><span class="cx">     OwnPtr&lt;DownloadProxyMap&gt; m_downloadProxyMap;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleUserMessageCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -53,10 +53,15 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    InjectedBundleUserMessageEncoder(const InjectedBundleUserMessageEncoder&amp;, API::Object* root)
+        : Base(root)
+    {
+    }
+
</ins><span class="cx">     void encode(CoreIPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx">     {
</span><span class="cx">         API::Object::Type type = API::Object::Type::Null;
</span><del>-        if (baseEncode(encoder, type))
</del><ins>+        if (baseEncode(encoder, *this, type))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -133,10 +138,21 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case API::Object::Type::PageGroup: {
</span><del>-            WebPageGroupData pageGroupData;
-            if (!decoder.decode(pageGroupData))
</del><ins>+            bool isNewPageGroup;
+            if (!decoder.decode(isNewPageGroup))
</ins><span class="cx">                 return false;
</span><del>-            coder.m_root = WebProcess::shared().webPageGroup(pageGroupData);
</del><ins>+            
+            if (isNewPageGroup) {
+                WebPageGroupData pageGroupData;
+                if (!decoder.decode(pageGroupData))
+                    return false;
+                coder.m_root = WebProcess::shared().createWebPageGroup(pageGroupData.pageGroupID, pageGroupData);
+            } else {
+                uint64_t pageGroupID;
+                if (!decoder.decode(pageGroupID))
+                    return false;
+                coder.m_root = WebProcess::shared().webPageGroup(pageGroupID);
+            }
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -344,7 +344,9 @@
</span><span class="cx">     m_page-&gt;setCanStartMedia(false);
</span><span class="cx">     m_mayStartMediaWhenInWindow = parameters.mayStartMediaWhenInWindow;
</span><span class="cx"> 
</span><del>-    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
</del><ins>+    m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupID);
+    ASSERT(m_pageGroup);
+
</ins><span class="cx">     m_page-&gt;setGroupName(m_pageGroup-&gt;identifier());
</span><span class="cx">     m_page-&gt;setDeviceScaleFactor(parameters.deviceScaleFactor);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -704,6 +704,12 @@
</span><span class="cx">     parentProcessConnection()-&gt;send(Messages::WebProcessProxy::DidDestroyFrame(frameID), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebPageGroupProxy* WebProcess::createWebPageGroup(uint64_t pageGroupID, const WebPageGroupData&amp; pageGroupData)
+{
+    ASSERT(!m_pageGroupMap.contains(pageGroupID));
+    return m_pageGroupMap.add(pageGroupID, WebPageGroupProxy::create(pageGroupData)).iterator-&gt;value.get();
+}
+
</ins><span class="cx"> WebPageGroupProxy* WebProcess::webPageGroup(PageGroup* pageGroup)
</span><span class="cx"> {
</span><span class="cx">     for (HashMap&lt;uint64_t, RefPtr&lt;WebPageGroupProxy&gt;&gt;::const_iterator it = m_pageGroupMap.begin(), end = m_pageGroupMap.end(); it != end; ++it) {
</span><span class="lines">@@ -719,17 +725,6 @@
</span><span class="cx">     return m_pageGroupMap.get(pageGroupID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData&amp; pageGroupData)
-{
-    HashMap&lt;uint64_t, RefPtr&lt;WebPageGroupProxy&gt;&gt;::AddResult result = m_pageGroupMap.add(pageGroupData.pageGroupID, nullptr);
-    if (result.isNewEntry) {
-        ASSERT(!result.iterator-&gt;value);
-        result.iterator-&gt;value = WebPageGroupProxy::create(pageGroupData);
-    }
-
-    return result.iterator-&gt;value.get();
-}
-
</del><span class="cx"> void WebProcess::clearResourceCaches(ResourceCachesToClear resourceCachesToClear)
</span><span class="cx"> {
</span><span class="cx">     platformClearResourceCaches(resourceCachesToClear);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -127,9 +127,9 @@
</span><span class="cx">     void addWebFrame(uint64_t, WebFrame*);
</span><span class="cx">     void removeWebFrame(uint64_t);
</span><span class="cx"> 
</span><ins>+    WebPageGroupProxy* createWebPageGroup(uint64_t pageGroupID, const WebPageGroupData&amp;);
</ins><span class="cx">     WebPageGroupProxy* webPageGroup(WebCore::PageGroup*);
</span><span class="cx">     WebPageGroupProxy* webPageGroup(uint64_t pageGroupID);
</span><del>-    WebPageGroupProxy* webPageGroup(const WebPageGroupData&amp;);
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (159602 => 159603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2013-11-21 02:00:10 UTC (rev 159602)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2013-11-21 04:09:24 UTC (rev 159603)
</span><span class="lines">@@ -27,6 +27,9 @@
</span><span class="cx">     # Create a new page.
</span><span class="cx">     CreateWebPage(uint64_t newPageID, WebKit::WebPageCreationParameters pageCreationParameters)
</span><span class="cx"> 
</span><ins>+    # Create a new page group.
+    CreateWebPageGroup(uint64_t newPageGroupID, WebKit::WebPageGroupData pageGroupData)
+
</ins><span class="cx">     # Visited link tracking.
</span><span class="cx">     SetVisitedLinkTable(WebKit::SharedMemory::Handle handle)
</span><span class="cx">     VisitedLinkStateChanged(Vector&lt;WebCore::LinkHash&gt; linkHashes)
</span></span></pre>
</div>
</div>

</body>
</html>