<!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>[42367] trunk/WebCore</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/42367">42367</a></dd>
<dt>Author</dt> <dd>levin@chromium.org</dd>
<dt>Date</dt> <dd>2009-04-09 13:45:34 -0700 (Thu, 09 Apr 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>2009-04-09  Drew Wilson  &lt;atwilson@google.com&gt;

        Reviewed by Alexey Proskuryakov.

        https://bugs.webkit.org/show_bug.cgi?id=25030
        Refactor MessagePort code to enable Chrome to use a MessagePortProxy object
        instead of a real MessagePort for the entangledPort, since it could
        theoretically live in a separate process.

        The goal of this refactoring is to remove all assumptions that the object
        representing the entangled port is actually of type MessagePort. All
        operations that were previously directly modifying private MessagePort member
        variables in the entangled port (i.e. entangle(), postMessage()) have been changed
        to invoke functions in the  MessagePortProxy interface instead which will allow
        the Chrome bindings to proxy these calls to another process.

        No new layout tests, as this is just a refactoring with no bug fixes
        or new functionality.

        * GNUmakefile.am:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSMessagePortCustom.cpp:
        (WebCore::JSMessagePort::mark):
        * dom/MessagePort.cpp:
        (WebCore::MessagePort::clone):
        (WebCore::MessagePort::postMessage):
        (WebCore::MessagePort::deliverMessage):
        (WebCore::MessagePort::startConversation):
        (WebCore::MessagePort::close):
        (WebCore::MessagePort::entangle):
        (WebCore::MessagePort::unentangle):
        * dom/MessagePort.h:
        (WebCore::MessagePort::entangledPort):
        * dom/MessagePortProxy.h: Added.
        (WebCore::MessagePortProxy::~MessagePortProxy):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreGNUmakefileam">trunk/WebCore/GNUmakefile.am</a></li>
<li><a href="#trunkWebCoreWebCorevcprojWebCorevcproj">trunk/WebCore/WebCore.vcproj/WebCore.vcproj</a></li>
<li><a href="#trunkWebCoreWebCorexcodeprojprojectpbxproj">trunk/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkWebCorebindingsjsJSMessagePortCustomcpp">trunk/WebCore/bindings/js/JSMessagePortCustom.cpp</a></li>
<li><a href="#trunkWebCoredomMessagePortcpp">trunk/WebCore/dom/MessagePort.cpp</a></li>
<li><a href="#trunkWebCoredomMessagePorth">trunk/WebCore/dom/MessagePort.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebCoredomMessagePortProxyh">trunk/WebCore/dom/MessagePortProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/ChangeLog        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2009-04-09  Drew Wilson  &lt;atwilson@google.com&gt;
+
+        Reviewed by Alexey Proskuryakov.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25030
+        Refactor MessagePort code to enable Chrome to use a MessagePortProxy object
+        instead of a real MessagePort for the entangledPort, since it could
+        theoretically live in a separate process.
+
+        The goal of this refactoring is to remove all assumptions that the object
+        representing the entangled port is actually of type MessagePort. All
+        operations that were previously directly modifying private MessagePort member
+        variables in the entangled port (i.e. entangle(), postMessage()) have been changed
+        to invoke functions in the  MessagePortProxy interface instead which will allow
+        the Chrome bindings to proxy these calls to another process.
+
+        No new layout tests, as this is just a refactoring with no bug fixes
+        or new functionality.
+
+        * GNUmakefile.am:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSMessagePortCustom.cpp:
+        (WebCore::JSMessagePort::mark):
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::clone):
+        (WebCore::MessagePort::postMessage):
+        (WebCore::MessagePort::deliverMessage):
+        (WebCore::MessagePort::startConversation):
+        (WebCore::MessagePort::close):
+        (WebCore::MessagePort::entangle):
+        (WebCore::MessagePort::unentangle):
+        * dom/MessagePort.h:
+        (WebCore::MessagePort::entangledPort):
+        * dom/MessagePortProxy.h: Added.
+        (WebCore::MessagePortProxy::~MessagePortProxy):
+
</ins><span class="cx"> 2009-04-08  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Geoffrey &quot;Big Boy&quot; Garen.
</span></span></pre></div>
<a id="trunkWebCoreGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/GNUmakefile.am (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/GNUmakefile.am        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/GNUmakefile.am        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -636,6 +636,7 @@
</span><span class="cx">         WebCore/dom/MessageEvent.h \
</span><span class="cx">         WebCore/dom/MessagePort.cpp \
</span><span class="cx">         WebCore/dom/MessagePort.h \
</span><ins>+        WebCore/dom/MessagePortProxy.h \
</ins><span class="cx">         WebCore/dom/MouseEvent.cpp \
</span><span class="cx">         WebCore/dom/MouseEvent.h \
</span><span class="cx">         WebCore/dom/MouseRelatedEvent.cpp \
</span></span></pre></div>
<a id="trunkWebCoreWebCorevcprojWebCorevcproj"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.vcproj/WebCore.vcproj (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.vcproj/WebCore.vcproj        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/WebCore.vcproj/WebCore.vcproj        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -11410,6 +11410,10 @@
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><span class="cx">                         &lt;File
</span><ins>+                                RelativePath=&quot;..\dom\MessagePortProxy.h&quot;
+                                &gt;
+                        &lt;/File&gt;
+                        &lt;File
</ins><span class="cx">                                 RelativePath=&quot;..\dom\MouseEvent.cpp&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                                 &lt;FileConfiguration
</span></span></pre></div>
<a id="trunkWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.xcodeproj/project.pbxproj (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -621,6 +621,7 @@
</span><span class="cx">                 41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */; };
</span><span class="cx">                 4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
</span><span class="cx">                 412A68470F6B03DD000EA66E /* ScriptObjectQuarantine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */; };
</span><ins>+                415E3EF60F8D67FE007EEB50 /* MessagePortProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 415E3EF50F8D67FE007EEB50 /* MessagePortProxy.h */; };
</ins><span class="cx">                 416E75BE0EDF8FD700360E1D /* ScriptCallStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */; };
</span><span class="cx">                 416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */; };
</span><span class="cx">                 416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; };
</span><span class="lines">@@ -5524,6 +5525,7 @@
</span><span class="cx">                 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptObjectQuarantine.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                415E3EF50F8D67FE007EEB50 /* MessagePortProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagePortProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStack.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14437,6 +14439,7 @@
</span><span class="cx">                                 75793E820D0CE0B3007FC0AC /* MessageEvent.idl */,
</span><span class="cx">                                 E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */,
</span><span class="cx">                                 E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */,
</span><ins>+                                415E3EF50F8D67FE007EEB50 /* MessagePortProxy.h */,
</ins><span class="cx">                                 E1ADECC60E76AD1F004A1A5E /* MessagePort.idl */,
</span><span class="cx">                                 85031B2F0A44EFC700F992E0 /* MouseEvent.cpp */,
</span><span class="cx">                                 85031B300A44EFC700F992E0 /* MouseEvent.h */,
</span><span class="lines">@@ -16801,6 +16804,7 @@
</span><span class="cx">                                 1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */,
</span><span class="cx">                                 935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */,
</span><span class="cx">                                 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */,
</span><ins>+                                415E3EF60F8D67FE007EEB50 /* MessagePortProxy.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSMessagePortCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSMessagePortCustom.cpp (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSMessagePortCustom.cpp        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/bindings/js/JSMessagePortCustom.cpp        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     markIfNotNull(m_impl-&gt;onmessage());
</span><span class="cx">     markIfNotNull(m_impl-&gt;onclose());
</span><span class="cx"> 
</span><del>-    if (MessagePort* entangledPort = m_impl-&gt;entangledPort()) {
</del><ins>+    if (MessagePortProxy* entangledPort = m_impl-&gt;entangledPort()) {
</ins><span class="cx">         DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)-&gt;globalData(), entangledPort);
</span><span class="cx">         if (wrapper &amp;&amp; !wrapper-&gt;marked())
</span><span class="cx">             wrapper-&gt;mark();
</span></span></pre></div>
<a id="trunkWebCoredomMessagePortcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessagePort.cpp (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessagePort.cpp        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/dom/MessagePort.cpp        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MessagePort&gt; remotePort = m_entangledPort;
</del><ins>+    RefPtr&lt;MessagePortProxy&gt; remotePort = m_entangledPort;
</ins><span class="cx">     RefPtr&lt;MessagePort&gt; newPort = MessagePort::create(0);
</span><span class="cx"> 
</span><span class="cx">     // Move all the events in the port message queue of original port to the port message queue of new port, if any, leaving the new port's port message queue in its initial closed state.
</span><span class="lines">@@ -143,11 +143,16 @@
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_entangledPort-&gt;m_messageQueue.append(EventData::create(message, newMessagePort));
-    if (m_entangledPort-&gt;m_queueIsOpen &amp;&amp; m_entangledPort-&gt;m_scriptExecutionContext)
-        m_entangledPort-&gt;m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
</del><ins>+    m_entangledPort-&gt;deliverMessage(message, newMessagePort);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MessagePort::deliverMessage(const String&amp; message, PassRefPtr&lt;MessagePort&gt; dataPort)
+{
+    m_messageQueue.append(EventData::create(message, dataPort));
+    if (m_queueIsOpen &amp;&amp; m_scriptExecutionContext)
+        m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
+}
+
</ins><span class="cx"> PassRefPtr&lt;MessagePort&gt; MessagePort::startConversation(ScriptExecutionContext* scriptExecutionContext, const String&amp; message)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;MessagePort&gt; port1 = MessagePort::create(scriptExecutionContext);
</span><span class="lines">@@ -157,9 +162,7 @@
</span><span class="cx"> 
</span><span class="cx">     entangle(port1.get(), port2.get());
</span><span class="cx"> 
</span><del>-    m_entangledPort-&gt;m_messageQueue.append(EventData::create(message, port2));
-    if (m_entangledPort-&gt;m_queueIsOpen &amp;&amp; m_entangledPort-&gt;m_scriptExecutionContext)
-        m_entangledPort-&gt;m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
</del><ins>+    m_entangledPort-&gt;deliverMessage(message, port2);
</ins><span class="cx">     return port1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -177,35 +180,37 @@
</span><span class="cx">     if (!m_entangledPort)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    MessagePort* otherPort = m_entangledPort;
</del><ins>+    MessagePortProxy* otherPort = m_entangledPort;
</ins><span class="cx">     unentangle();
</span><span class="cx"> 
</span><span class="cx">     queueCloseEvent();
</span><span class="cx">     otherPort-&gt;queueCloseEvent();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MessagePort::entangle(MessagePort* port1, MessagePort* port2)
</del><ins>+void MessagePort::entangle(MessagePortProxy* port1, MessagePortProxy* port2)
</ins><span class="cx"> {
</span><del>-    if (port1-&gt;m_entangledPort) {
-        ASSERT(port1-&gt;m_entangledPort != port2);
-        port1-&gt;unentangle();
-    }
</del><ins>+    port1-&gt;entangle(port2);
+    port2-&gt;entangle(port1);
+}
</ins><span class="cx"> 
</span><del>-    if (port2-&gt;m_entangledPort) {
-        ASSERT(port2-&gt;m_entangledPort != port1);
-        port2-&gt;unentangle();
</del><ins>+void MessagePort::entangle(MessagePortProxy* remote)
+{
+    // Unentangle from our current port first.
+    if (m_entangledPort) {
+        ASSERT(m_entangledPort != remote);
+        unentangle();
</ins><span class="cx">     }
</span><del>-
-    port1-&gt;m_entangledPort = port2;
-    port2-&gt;m_entangledPort = port1;
</del><ins>+    m_entangledPort = remote;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::unentangle()
</span><span class="cx"> {
</span><del>-    ASSERT(this == m_entangledPort-&gt;m_entangledPort);
-
-    m_entangledPort-&gt;m_entangledPort = 0;
-    m_entangledPort = 0;
</del><ins>+    // Unentangle our end before unentangling the other end.
+    if (m_entangledPort) {
+        MessagePortProxy* remote = m_entangledPort;
+        m_entangledPort = 0;
+        remote-&gt;unentangle();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::contextDestroyed()
</span></span></pre></div>
<a id="trunkWebCoredomMessagePorth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessagePort.h (42366 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessagePort.h        2009-04-09 20:45:10 UTC (rev 42366)
+++ trunk/WebCore/dom/MessagePort.h        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;AtomicStringHash.h&quot;
</span><span class="cx"> #include &quot;EventListener.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><ins>+#include &quot;MessagePortProxy.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="lines">@@ -46,7 +47,7 @@
</span><span class="cx">     class String;
</span><span class="cx">     class WorkerContext;
</span><span class="cx"> 
</span><del>-    class MessagePort : public RefCounted&lt;MessagePort&gt;, public EventTarget {
</del><ins>+    class MessagePort : public MessagePortProxy, public EventTarget {
</ins><span class="cx">     public:
</span><span class="cx">         static PassRefPtr&lt;MessagePort&gt; create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
</span><span class="cx">         ~MessagePort();
</span><span class="lines">@@ -60,11 +61,16 @@
</span><span class="cx">         void start();
</span><span class="cx">         void close();
</span><span class="cx"> 
</span><ins>+        // Implementations of MessagePortProxy APIs
+        virtual void entangle(MessagePortProxy*);
+        virtual void unentangle();
+        virtual void deliverMessage(const String&amp; message, PassRefPtr&lt;MessagePort&gt;);
+        virtual void queueCloseEvent();
+
</ins><span class="cx">         bool queueIsOpen() const { return m_queueIsOpen; }
</span><span class="cx"> 
</span><del>-        MessagePort* entangledPort() { return m_entangledPort; }
-        static void entangle(MessagePort*, MessagePort*);
-        void unentangle();
</del><ins>+        MessagePortProxy* entangledPort() { return m_entangledPort; }
+        static void entangle(MessagePortProxy*, MessagePortProxy*);
</ins><span class="cx"> 
</span><span class="cx">         void contextDestroyed();
</span><span class="cx">         void attachToContext(ScriptExecutionContext*);
</span><span class="lines">@@ -72,7 +78,6 @@
</span><span class="cx"> 
</span><span class="cx">         virtual MessagePort* toMessagePort() { return this; }
</span><span class="cx"> 
</span><del>-        void queueCloseEvent();
</del><span class="cx">         void dispatchMessages();
</span><span class="cx"> 
</span><span class="cx">         virtual void addEventListener(const AtomicString&amp; eventType, PassRefPtr&lt;EventListener&gt;, bool useCapture);
</span><span class="lines">@@ -83,8 +88,8 @@
</span><span class="cx">         typedef HashMap&lt;AtomicString, ListenerVector&gt; EventListenersMap;
</span><span class="cx">         EventListenersMap&amp; eventListeners() { return m_eventListeners; }
</span><span class="cx"> 
</span><del>-        using RefCounted&lt;MessagePort&gt;::ref;
-        using RefCounted&lt;MessagePort&gt;::deref;
</del><ins>+        using RefCounted&lt;MessagePortProxy&gt;::ref;
+        using RefCounted&lt;MessagePortProxy&gt;::deref;
</ins><span class="cx"> 
</span><span class="cx">         bool hasPendingActivity();
</span><span class="cx"> 
</span><span class="lines">@@ -105,7 +110,7 @@
</span><span class="cx"> 
</span><span class="cx">         void dispatchCloseEvent();
</span><span class="cx"> 
</span><del>-        MessagePort* m_entangledPort;
</del><ins>+        MessagePortProxy* m_entangledPort;
</ins><span class="cx"> 
</span><span class="cx">         // FIXME: EventData is necessary to pass messages to other threads. In single threaded case, we can just queue a created event.
</span><span class="cx">         struct EventData : public RefCounted&lt;EventData&gt; {
</span></span></pre></div>
<a id="trunkWebCoredomMessagePortProxyh"></a>
<div class="addfile"><h4>Added: trunk/WebCore/dom/MessagePortProxy.h (0 => 42367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessagePortProxy.h                                (rev 0)
+++ trunk/WebCore/dom/MessagePortProxy.h        2009-04-09 20:45:34 UTC (rev 42367)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+#ifndef MessagePortProxy_h
+#define MessagePortProxy_h
+
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+
+namespace WebCore {
+
+    class MessagePort;
+    class String;
+
+    class MessagePortProxy : public RefCounted&lt;MessagePortProxy&gt; {
+    public:
+        virtual ~MessagePortProxy() { }
+
+        virtual void entangle(MessagePortProxy*) = 0;
+        virtual void unentangle() = 0;
+        virtual void deliverMessage(const String&amp; message, PassRefPtr&lt;MessagePort&gt;) = 0;
+        virtual void queueCloseEvent() = 0;
+    };
+
+} // namespace WebCore
+
+#endif // MessagePortProxy_h
</ins></span></pre>
</div>
</div>

</body>
</html>