<!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>[177543] trunk/Source</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/177543">177543</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-18 17:02:58 -0800 (Thu, 18 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use MachSendRight in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=139800
Reviewed by Tim Horton.
Source/WebCore:
* WebCore.exp.in:
* platform/cocoa/MachSendRight.h:
(WebCore::MachSendRight::MachSendRight):
(WebCore::MachSendRight::sendRight):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::createFromSendRight):
(IOSurface::createFromMachPort): Deleted.
Source/WebKit2:
* Platform/IPC/ArgumentEncoder.h:
(IPC::ArgumentEncoder::encode):
(IPC::ArgumentEncoder::operator<<):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode):
(WebKit::RemoteLayerBackingStore::decode):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<MachSendRight>::encode):
(IPC::ArgumentCoder<MachSendRight>::decode):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaMachSendRighth">trunk/Source/WebCore/platform/cocoa/MachSendRight.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCArgumentEncoderh">trunk/Source/WebKit2/Platform/IPC/ArgumentEncoder.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCodersh">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm">trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebCore/ChangeLog        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-12-18 Anders Carlsson <andersca@apple.com>
+
+ Use MachSendRight in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=139800
+
+ Reviewed by Tim Horton.
+
+ * WebCore.exp.in:
+ * platform/cocoa/MachSendRight.h:
+ (WebCore::MachSendRight::MachSendRight):
+ (WebCore::MachSendRight::sendRight):
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (IOSurface::createFromSendRight):
+ (IOSurface::createFromMachPort): Deleted.
+
</ins><span class="cx"> 2014-12-18 Gavin Barraclough <barraclough@apple.com>
</span><span class="cx">
</span><span class="cx"> Add strong typing to RefCounter interface, return value as a bool.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -325,7 +325,9 @@
</span><span class="cx"> __ZN7WebCore13KeyboardEventC1ERKNS_21PlatformKeyboardEventEPNS_9DOMWindowE
</span><span class="cx"> __ZN7WebCore13KeyboardEventC1Ev
</span><span class="cx"> __ZN7WebCore13MachSendRight13leakSendRightEv
</span><ins>+__ZN7WebCore13MachSendRight5adoptEj
</ins><span class="cx"> __ZN7WebCore13MachSendRightD1Ev
</span><ins>+__ZN7WebCore13MachSendRightaSEOS0_
</ins><span class="cx"> __ZN7WebCore13NodeTraversal13deepLastChildEPNS_4NodeE
</span><span class="cx"> __ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeE
</span><span class="cx"> __ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeES3_
</span><span class="lines">@@ -3246,7 +3248,7 @@
</span><span class="cx"> __ZN7WebCore9IOSurface11createImageEv
</span><span class="cx"> __ZN7WebCore9IOSurface13setIsVolatileEb
</span><span class="cx"> __ZN7WebCore9IOSurface15createFromImageEP7CGImage
</span><del>-__ZN7WebCore9IOSurface18createFromMachPortEjNS_10ColorSpaceE
</del><ins>+__ZN7WebCore9IOSurface19createFromSendRightERKNS_13MachSendRightENS_10ColorSpaceE
</ins><span class="cx"> __ZN7WebCore9IOSurface21ensureGraphicsContextEv
</span><span class="cx"> __ZN7WebCore9IOSurface21ensurePlatformContextEv
</span><span class="cx"> __ZN7WebCore9IOSurface22releaseGraphicsContextEv
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaMachSendRighth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/MachSendRight.h (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/MachSendRight.h        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebCore/platform/cocoa/MachSendRight.h        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -35,13 +35,19 @@
</span><span class="cx"> static MachSendRight adopt(mach_port_t);
</span><span class="cx"> static MachSendRight create(mach_port_t);
</span><span class="cx">
</span><ins>+ MachSendRight()
+ : m_port(MACH_PORT_NULL)
+ {
+ }
+
</ins><span class="cx"> MachSendRight(MachSendRight&&);
</span><span class="cx"> ~MachSendRight();
</span><span class="cx">
</span><span class="cx"> MachSendRight& operator=(MachSendRight&&);
</span><span class="cx">
</span><ins>+ mach_port_t sendRight() const { return m_port; }
+
</ins><span class="cx"> MachSendRight copySendRight() const;
</span><del>-
</del><span class="cx"> mach_port_t leakSendRight() WARN_UNUSED_RETURN;
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> class IOSurface final : public RefCounted<IOSurface> {
</span><span class="cx"> public:
</span><span class="cx"> WEBCORE_EXPORT static PassRefPtr<IOSurface> create(IntSize, ColorSpace);
</span><del>- WEBCORE_EXPORT static PassRefPtr<IOSurface> createFromMachPort(mach_port_t, ColorSpace);
</del><ins>+ WEBCORE_EXPORT static PassRefPtr<IOSurface> createFromSendRight(const MachSendRight&, ColorSpace);
</ins><span class="cx"> static PassRefPtr<IOSurface> createFromSurface(IOSurfaceRef, ColorSpace);
</span><span class="cx"> WEBCORE_EXPORT static PassRefPtr<IOSurface> createFromImage(CGImageRef);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -60,9 +60,9 @@
</span><span class="cx"> return adoptRef(new IOSurface(size, colorSpace));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<IOSurface> IOSurface::createFromMachPort(mach_port_t machPort, ColorSpace colorSpace)
</del><ins>+PassRefPtr<IOSurface> IOSurface::createFromSendRight(const MachSendRight& sendRight, ColorSpace colorSpace)
</ins><span class="cx"> {
</span><del>- RetainPtr<IOSurfaceRef> surface = adoptCF(IOSurfaceLookupFromMachPort(machPort));
</del><ins>+ RetainPtr<IOSurfaceRef> surface = adoptCF(IOSurfaceLookupFromMachPort(sendRight.sendRight()));
</ins><span class="cx"> return IOSurface::createFromSurface(surface.get(), colorSpace);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-12-18 Anders Carlsson <andersca@apple.com>
+
+ Use MachSendRight in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=139800
+
+ Reviewed by Tim Horton.
+
+ * Platform/IPC/ArgumentEncoder.h:
+ (IPC::ArgumentEncoder::encode):
+ (IPC::ArgumentEncoder::operator<<):
+ * Shared/WebCoreArgumentCoders.h:
+ * Shared/mac/RemoteLayerBackingStore.mm:
+ (WebKit::RemoteLayerBackingStore::encode):
+ (WebKit::RemoteLayerBackingStore::decode):
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (IPC::ArgumentCoder<MachSendRight>::encode):
+ (IPC::ArgumentCoder<MachSendRight>::decode):
+
</ins><span class="cx"> 2014-12-18 Gavin Barraclough <barraclough@apple.com>
</span><span class="cx">
</span><span class="cx"> Add strong typing to RefCounter interface, return value as a bool.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCArgumentEncoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/ArgumentEncoder.h (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/ArgumentEncoder.h        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebKit2/Platform/IPC/ArgumentEncoder.h        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -51,14 +51,14 @@
</span><span class="cx"> encode(static_cast<uint64_t>(t));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- template<typename T> void encode(const T& t)
</del><ins>+ template<typename T> void encode(T&& t)
</ins><span class="cx"> {
</span><del>- ArgumentCoder<T>::encode(*this, t);
</del><ins>+ ArgumentCoder<typename std::remove_const<typename std::remove_reference<T>::type>::type>::encode(*this, std::forward<T>(t));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- template<typename T> ArgumentEncoder& operator<<(const T& t)
</del><ins>+ template<typename T> ArgumentEncoder& operator<<(T&& t)
</ins><span class="cx"> {
</span><del>- encode(t);
</del><ins>+ encode(std::forward<T>(t));
</ins><span class="cx"> return *this;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> namespace WebCore {
</span><ins>+class MachSendRight;
</ins><span class="cx"> struct KeypressCommand;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -271,6 +272,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+template<> struct ArgumentCoder<WebCore::MachSendRight> {
+ static void encode(ArgumentEncoder&, WebCore::MachSendRight&&);
+ static bool decode(ArgumentDecoder&, WebCore::MachSendRight&);
+};
+
</ins><span class="cx"> template<> struct ArgumentCoder<WebCore::KeypressCommand> {
</span><span class="cx"> static void encode(ArgumentEncoder&, const WebCore::KeypressCommand&);
</span><span class="cx"> static bool decode(ArgumentDecoder&, WebCore::KeypressCommand&);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -107,8 +107,7 @@
</span><span class="cx">
</span><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx"> if (m_acceleratesDrawing) {
</span><del>- mach_port_t port = m_frontBuffer.surface->createSendRight().leakSendRight();
- encoder << IPC::MachPort(port, MACH_MSG_TYPE_MOVE_SEND);
</del><ins>+ encoder << m_frontBuffer.surface->createSendRight();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -136,11 +135,10 @@
</span><span class="cx">
</span><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx"> if (result.m_acceleratesDrawing) {
</span><del>- IPC::MachPort machPort;
- if (!decoder.decode(machPort))
</del><ins>+ MachSendRight sendRight;
+ if (!decoder.decode(sendRight))
</ins><span class="cx"> return false;
</span><del>- result.m_frontBuffer.surface = IOSurface::createFromMachPort(machPort.port(), ColorSpaceDeviceRGB);
- mach_port_deallocate(mach_task_self(), machPort.port());
</del><ins>+ result.m_frontBuffer.surface = IOSurface::createFromSendRight(sendRight, ColorSpaceDeviceRGB);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (177542 => 177543)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2014-12-19 01:00:23 UTC (rev 177542)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2014-12-19 01:02:58 UTC (rev 177543)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import <WebCore/ContentFilter.h>
</span><span class="cx"> #import <WebCore/Credential.h>
</span><span class="cx"> #import <WebCore/KeyboardEvent.h>
</span><ins>+#import <WebCore/MachSendRight.h>
</ins><span class="cx"> #import <WebCore/ProtectionSpace.h>
</span><span class="cx"> #import <WebCore/ResourceError.h>
</span><span class="cx"> #import <WebCore/ResourceRequest.h>
</span><span class="lines">@@ -367,6 +368,24 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ArgumentCoder<MachSendRight>::encode(ArgumentEncoder& encoder, MachSendRight&& sendRight)
+{
+ encoder << Attachment(sendRight.leakSendRight(), MACH_MSG_TYPE_MOVE_SEND);
+}
+
+bool ArgumentCoder<MachSendRight>::decode(ArgumentDecoder& decoder, MachSendRight& sendRight)
+{
+ Attachment attachment;
+ if (!decoder.decode(attachment))
+ return false;
+
+ if (attachment.disposition() != MACH_MSG_TYPE_MOVE_SEND)
+ return false;
+
+ sendRight = MachSendRight::adopt(attachment.port());
+ return true;
+}
+
</ins><span class="cx"> void ArgumentCoder<KeypressCommand>::encode(ArgumentEncoder& encoder, const KeypressCommand& keypressCommand)
</span><span class="cx"> {
</span><span class="cx"> encoder << keypressCommand.commandName << keypressCommand.text;
</span></span></pre>
</div>
</div>
</body>
</html>