⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 194326 in webkit


Ignore:
Timestamp:
Dec 20, 2015, 8:23:09 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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 <WebKit@JeremyZerfas.com> 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.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r194319 r194326  
     12015-12-20  Jeremy Zerfas  <WebKit@JeremyZerfas.com>
     2
     3        Don't allocate a NSImage and skip unneeded call to TIFFRepresentation when copying image to clipboard.
     4        https://bugs.webkit.org/show_bug.cgi?id=152374
     5
     6        Reviewed by Darin Adler.
     7
     8        Added test to make sure that when copying a 50 frame 500x500 animation
     9        (50 MB uncompressed) to the clipboard, the additional memory usage is
     10        kept to less than 200 MB.
     11
     12        * fast/images/image-copy-memory-usage-expected.txt: Added.
     13        * fast/images/image-copy-memory-usage.html: Added.
     14        * fast/images/resources/dot-moving-in-a-circle-animation.gif: Added.
     15
    1162015-12-20  Commit Queue  <commit-queue@webkit.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r194324 r194326  
     12015-12-20  Jeremy Zerfas  <WebKit@JeremyZerfas.com>
     2
     3        Don't allocate a NSImage and skip unneeded call to TIFFRepresentation when copying image to clipboard.
     4        https://bugs.webkit.org/show_bug.cgi?id=152374
     5
     6        Reviewed by Darin Adler.
     7
     8        When copying an image to the clipboard, don't bother allocating a
     9        NSImage and skip the unneeded call to TIFFRepresentation since the data
     10        from the previous getTIFFRepresentation call can be used instead. This
     11        considerably reduces the amount of memory and CPU time used for large
     12        images/animations.
     13
     14        Test: fast/images/image-copy-memory-usage.html
     15
     16        * platform/mac/PasteboardMac.mm:
     17        (WebCore::Pasteboard::write):
     18
    1192015-12-20  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    220
  • trunk/Source/WebCore/platform/mac/PasteboardMac.mm

    r183976 r194326  
    256256void Pasteboard::write(const PasteboardImage& pasteboardImage)
    257257{
    258     NSData *imageData = [pasteboardImage.image->getNSImage() TIFFRepresentation];
     258    CFDataRef imageData = pasteboardImage.image->getTIFFRepresentation();
    259259    if (!imageData)
    260260        return;
    … …  
    264264
    265265    m_changeCount = writeURLForTypes(writableTypesForImage(), m_pasteboardName, pasteboardImage.url);
    266     m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData(imageData), NSTIFFPboardType, m_pasteboardName);
     266    m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapCFData(imageData), NSTIFFPboardType, m_pasteboardName);
    267267    writeFileWrapperAsRTFDAttachment(fileWrapper(pasteboardImage), m_pasteboardName, m_changeCount);
    268268}
Note: See TracChangeset for help on using the changeset viewer.