<!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>[194326] trunk</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/194326">194326</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-20 20:23:09 -0800 (Sun, 20 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Don't allocate a NSImage and skip unneeded call to TIFFRepresentation when copying image to clipboard.
https://bugs.webkit.org/show_bug.cgi?id=152374

Patch by Jeremy Zerfas &lt;WebKit@JeremyZerfas.com&gt; on 2015-12-20
Reviewed by Darin Adler.

Source/WebCore:

When copying an image to the clipboard, don't bother allocating a
NSImage and skip the unneeded call to TIFFRepresentation since the data
from the previous getTIFFRepresentation call can be used instead. This
considerably reduces the amount of memory and CPU time used for large
images/animations.

Test: fast/images/image-copy-memory-usage.html

* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write):

LayoutTests:

Added test to make sure that when copying a 50 frame 500x500 animation
(50 MB uncompressed) to the clipboard, the additional memory usage is
kept to less than 200 MB.

* fast/images/image-copy-memory-usage-expected.txt: Added.
* fast/images/image-copy-memory-usage.html: Added.
* fast/images/resources/dot-moving-in-a-circle-animation.gif: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPasteboardMacmm">trunk/Source/WebCore/platform/mac/PasteboardMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimagecopymemoryusageexpectedtxt">trunk/LayoutTests/fast/images/image-copy-memory-usage-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagecopymemoryusagehtml">trunk/LayoutTests/fast/images/image-copy-memory-usage.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesdotmovinginacircleanimationgif">trunk/LayoutTests/fast/images/resources/dot-moving-in-a-circle-animation.gif</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194325 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-21 02:54:32 UTC (rev 194325)
+++ trunk/LayoutTests/ChangeLog        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-12-20  Jeremy Zerfas  &lt;WebKit@JeremyZerfas.com&gt;
+
+        Don't allocate a NSImage and skip unneeded call to TIFFRepresentation when copying image to clipboard.
+        https://bugs.webkit.org/show_bug.cgi?id=152374
+
+        Reviewed by Darin Adler.
+
+        Added test to make sure that when copying a 50 frame 500x500 animation
+        (50 MB uncompressed) to the clipboard, the additional memory usage is
+        kept to less than 200 MB.
+
+        * fast/images/image-copy-memory-usage-expected.txt: Added.
+        * fast/images/image-copy-memory-usage.html: Added.
+        * fast/images/resources/dot-moving-in-a-circle-animation.gif: Added.
+
</ins><span class="cx"> 2015-12-20  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r194033 and r194267.
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagecopymemoryusageexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-copy-memory-usage-expected.txt (0 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-copy-memory-usage-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-copy-memory-usage-expected.txt        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+This is an automated test related to Bug 152374 - Reduce resource usage when copying image to clipboard.
+
+This tests how much memory is used while copying an animation into the clipboard. The animation consists of 50 500x500 frames and, assuming 32 bits per pixel, will use 50 MB of memory when uncompressed. To pass the test, after copying the animation to the clipboard, the memory usage of the browser must not have increased by more than 200 MBs.
+
+In order to make this test more accurate it should be performed in a freshly started browser session that has nothing else open and which has an empty cache.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS changeInCommittedVMBytes &lt; 200000000 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagecopymemoryusagehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-copy-memory-usage.html (0 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-copy-memory-usage.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-copy-memory-usage.html        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;meta charset=&quot;UTF-8&quot; /&gt;
+                &lt;title&gt;image-copy-memory-usage.html&lt;/title&gt;
+                &lt;script src=&quot;../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+        &lt;/head&gt;
+
+        &lt;body&gt;
+                &lt;script type=&quot;text/javascript&quot;&gt;
+                        description(&quot;This is an automated test related to &quot; +
+                            &quot;&lt;a href=\&quot;https://bugs.webkit.org/show_bug.cgi?id=152374\&quot;&gt;Bug 152374 - Reduce resource usage when &quot; +
+                            &quot;copying image to clipboard&lt;/a&gt;.&lt;br /&gt;&quot; +
+                            &quot;&lt;br /&gt;&quot; +
+                            &quot;This tests how much memory is used while copying an animation into the clipboard. The animation &quot; +
+                            &quot;consists of 50 500x500 frames and, assuming 32 bits per pixel, will use 50 MB of memory when &quot; +
+                            &quot;uncompressed. To pass the test, after copying the animation to the clipboard, the memory usage of &quot; +
+                            &quot;the browser must not have increased by more than 200 MBs.&lt;br /&gt;&quot; +
+                            &quot;&lt;br /&gt;&quot; +
+                            &quot;In order to make this test more accurate it should be performed in a freshly started browser &quot; +
+                            &quot;session that has nothing else open and which has an empty cache.&quot;);
+
+                        window.jsTestIsAsync = true;
+
+                        var changeInCommittedVMBytes; // Needs to be global for shouldBeTrue() to see it.
+
+                        function tryToSetUpAndRunTest()
+                        {
+                            // Exit if the mallocStatistics() function is not available since it is needed to automatically
+                            // determine the results of the test.
+                            if (!window.internals || !window.internals.mallocStatistics) {
+                                debug(&quot;The mallocStatistics() function is not available, you will need to check memory usage &quot; +
+                                    &quot;manually. First record the memory usage of the browser. Then copy the animation into the &quot; +
+                                    &quot;clipboard. Finally check the memory usage of the browser again and subtract the amount of &quot; +
+                                    &quot;memory that it was using previously. If the difference is greater than 200 MBs, the browser &quot; +
+                                   &quot;has failed the test.&lt;br /&gt;&quot;);
+                                return;
+                            }
+
+                            var initialCommittedVMBytes = window.internals.mallocStatistics().committedVMBytes;
+                            // Add a listener for clipboard copy events which will then check how much memory was used to perform
+                            // the copy and also finish the test. setTimeout() is used with a zero delay in order to cause this to
+                            // run after the copy is finished.
+                            document.getElementById(&quot;animationFrame&quot;).contentWindow.document.addEventListener(&quot;copy&quot;,
+                                setTimeout(
+                                        function()
+                                    {
+                                        var finalCommittedVMBytes = window.internals.mallocStatistics().committedVMBytes;
+                                        changeInCommittedVMBytes = finalCommittedVMBytes - initialCommittedVMBytes;
+                                        shouldBeTrue(&quot;changeInCommittedVMBytes &lt; 200000000&quot;);
+                                        window.finishJSTest();
+                                    },
+                                    0),
+                                false);
+
+                            // Exit if execCommand(&quot;copy&quot;) is not supported since that is needed to automatically copy the animation
+                            // to the clipboard.
+                            if (!document.queryCommandSupported('copy')) {
+                                debug(&quot;execCommand(\&quot;copy\&quot;) is not supported. You will need to manually copy the animation into &quot; +
+                                    &quot;the clipboard to finish the test.&lt;br /&gt;&quot;);
+                                return;
+                            }
+
+                            document.getElementById(&quot;animationFrame&quot;).contentWindow.document.execCommand(&quot;copy&quot;);
+                        }
+                &lt;/script&gt;
+
+                &lt;!-- The &quot;Copy Image&quot; option doesn't show up in the image context menu if using a data URI and that might make
+                -    it difficult to perform a copy manually so load the image from a file instead.
+                --&gt;
+                &lt;iframe id=&quot;animationFrame&quot; width=&quot;500&quot; height=&quot;500&quot; onload=&quot;tryToSetUpAndRunTest()&quot;
+                  src=&quot;resources/dot-moving-in-a-circle-animation.gif&quot;&gt;
+                &lt;/iframe&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesresourcesdotmovinginacircleanimationgif"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/resources/dot-moving-in-a-circle-animation.gif (0 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/resources/dot-moving-in-a-circle-animation.gif                                (rev 0)
+++ trunk/LayoutTests/fast/images/resources/dot-moving-in-a-circle-animation.gif        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+GIF89a\xF4\xF4\xF1\xE6\xE6\xE6!\xFF NETSCAPE2.0!\xF9\xFF,\xF4\xF4@\xFF\x8C\x8F\xA9\xCB\xED\xA3\x9C\xB4ڋ\xB3޼\xFB\x86\xE2H\x96扦\xEAʶ\xEE \xC7\xF2L\xD7\xF6\x8D\xE7\xFA\xCE\xF7\xFE
+\x87Ģ\xF1\x88L*\x97̦\xF3        \x8DJ\xA7Ԫ\xF5\x8A\xCDj\xB7ܮ\xF7 \x8B\xC7\xE4\xB2\xF9\x8CN\xAB\xD7\xEC\xB6\xFB+\x8F\xCB\xE7\xF4\xBA\xFD\x8E\xCF\xEB\xF7\xFC\xBE\xFF(8HXhx\xA8\xA0\x80\xD8\xE8H\xB6\xB8\xF88IYiy\x89\x99\xA9\xB9\xC9\xD9\xE9\xF9        *:JZjz\x8A\x9A\xAA\xBA\xCA\xDA\xEA\xFA
++;K[k{\x8B\x9B\xAB\xBB\xCB\xDB\xEB\xFB ,&lt;L\l|\x8C\x9C\xAC\xBC\xCC\xDC\xEC\xFC -=M]m}\x8D\x9D\xAD\xBD\xCD\xDD\xED\xFD+.&gt;N^n~\x8E\x9E\xAE\xBE\xCE\xDE\xEE\xFE/?O_o\x8F\x9F\xAF\xBF\xCF\xDF\xEF\xFF0\xA0\xC0\x81 &lt;\x880\xA1… :|1\xA2ĉ+Z\xBC\x881\xA3ƍ\xFF;z\xFC2\xA4ȑ$K:\x8A\x84\x92\x91ɕ,[\xBA|        3\xA6̙4kڼ\x893\xA7Ν&lt;{\xFA\xFC        4\xA8СD\x8B=\x8A4\xA9ҥL\x9B:}
+5\xAAԩT\xABZ\xBD\x8A5\xAB֭\\xB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b \xC7\xF2L׶Z!\xF9,\xC9\x8C!\x8C\x8Fi\xC0\xA0\xAFZ\x83TJ\xED\xC5Gox\x8AYjhg\xAD\xC8\xE7\xC6\xF2L+!\xF9,\xD7\x89+!\x8C\x8Fy\x
 C0\xA0\xFFZ\x834HYսm\xDC\xDFZ\xA3S\x9A[\xBApl˼\xF2L#;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194325 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-21 02:54:32 UTC (rev 194325)
+++ trunk/Source/WebCore/ChangeLog        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-12-20  Jeremy Zerfas  &lt;WebKit@JeremyZerfas.com&gt;
+
+        Don't allocate a NSImage and skip unneeded call to TIFFRepresentation when copying image to clipboard.
+        https://bugs.webkit.org/show_bug.cgi?id=152374
+
+        Reviewed by Darin Adler.
+
+        When copying an image to the clipboard, don't bother allocating a
+        NSImage and skip the unneeded call to TIFFRepresentation since the data
+        from the previous getTIFFRepresentation call can be used instead. This
+        considerably reduces the amount of memory and CPU time used for large
+        images/animations.
+
+        Test: fast/images/image-copy-memory-usage.html
+
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::write):
+
</ins><span class="cx"> 2015-12-20  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reduce PassRefPtr uses in dom - 2
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPasteboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (194325 => 194326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2015-12-21 02:54:32 UTC (rev 194325)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2015-12-21 04:23:09 UTC (rev 194326)
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Pasteboard::write(const PasteboardImage&amp; pasteboardImage)
</span><span class="cx"> {
</span><del>-    NSData *imageData = [pasteboardImage.image-&gt;getNSImage() TIFFRepresentation];
</del><ins>+    CFDataRef imageData = pasteboardImage.image-&gt;getTIFFRepresentation();
</ins><span class="cx">     if (!imageData)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx">     ASSERT(MIMETypeRegistry::isSupportedImageResourceMIMEType(pasteboardImage.resourceMIMEType));
</span><span class="cx"> 
</span><span class="cx">     m_changeCount = writeURLForTypes(writableTypesForImage(), m_pasteboardName, pasteboardImage.url);
</span><del>-    m_changeCount = platformStrategies()-&gt;pasteboardStrategy()-&gt;setBufferForType(SharedBuffer::wrapNSData(imageData), NSTIFFPboardType, m_pasteboardName);
</del><ins>+    m_changeCount = platformStrategies()-&gt;pasteboardStrategy()-&gt;setBufferForType(SharedBuffer::wrapCFData(imageData), NSTIFFPboardType, m_pasteboardName);
</ins><span class="cx">     writeFileWrapperAsRTFDAttachment(fileWrapper(pasteboardImage), m_pasteboardName, m_changeCount);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>