Bug 134731 - Make SharedBuffer::append(SharedBuffer*) be smarter about CFData and data arrays
Summary: Make SharedBuffer::append(SharedBuffer*) be smarter about CFData and data arrays
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Pratik Solanki
URL:
Keywords:
Depends on:
Blocks: 134560
  Show dependency treegraph
 
Reported: 2014-07-08 10:31 PDT by Pratik Solanki
Modified: 2014-07-09 17:18 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.11 KB, patch)
2014-07-08 10:36 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff
Patch with build fix (5.73 KB, patch)
2014-07-08 13:22 PDT, Pratik Solanki
koivisto: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion (655.66 KB, application/zip)
2014-07-09 12:28 PDT, Build Bot
no flags Details
Patch with potential layout test fixes (5.51 KB, patch)
2014-07-09 15:26 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pratik Solanki 2014-07-08 10:31:56 PDT
Currently SharedBuffer::append(SharedBuffer*) copies over all the data from the target SharedBuffer. When the target buffer has a data array or a platform data, we can just keep a reference to that instead of doing a copy.
Comment 1 Pratik Solanki 2014-07-08 10:36:33 PDT
Created attachment 234571 [details]
Patch
Comment 2 Pratik Solanki 2014-07-08 13:22:05 PDT
Created attachment 234587 [details]
Patch with build fix
Comment 3 Antti Koivisto 2014-07-09 12:04:45 PDT
Comment on attachment 234587 [details]
Patch with build fix

View in context: https://bugs.webkit.org/attachment.cgi?id=234587&action=review

> Source/WebCore/ChangeLog:20
> +2014-07-08  Pratik Solanki  <psolanki@apple.com>
> +
> +        Make SharedBuffer::append(SharedBuffer*) be smarter about CFData and data arrays
> +        https://bugs.webkit.org/show_bug.cgi?id=134731
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        No new tests because no functional changes.
> +
> +        * platform/SharedBuffer.cpp:
> +        (WebCore::SharedBuffer::append):
> +        (WebCore::SharedBuffer::maybeAppendPlatformData):
> +        * platform/SharedBuffer.h:
> +        * platform/cf/SharedBufferCF.cpp:
> +        (WebCore::SharedBuffer::maybeAppendPlatformData):
> +        (WebCore::SharedBuffer::maybeAppendDataArray):
> +        * platform/soup/SharedBufferSoup.cpp:
> +        (WebCore::SharedBuffer::maybeAppendPlatformData):
> +
> +2014-07-08  Pratik Solanki  <psolanki@apple.com>

Two change logs. You could mention how it is smarter.
Comment 4 Build Bot 2014-07-09 12:28:43 PDT
Comment on attachment 234587 [details]
Patch with build fix

Attachment 234587 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6699772173877248

New failing tests:
js/regress/emscripten-cube2hash.html
fast/canvas/image-potential-subsample.html
fast/writing-mode/broken-ideographic-font.html
http/tests/multipart/multipart-replace-non-html-content.php
fast/writing-mode/broken-ideograph-small-caps.html
http/tests/multipart/multipart-html.php
Comment 5 Build Bot 2014-07-09 12:28:46 PDT
Created attachment 234652 [details]
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-07  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 6 Pratik Solanki 2014-07-09 15:26:09 PDT
Created attachment 234661 [details]
Patch with potential layout test fixes

I couldn't reproduce the exact layout test failures but noticed some bugs in the code when debugging.
Comment 7 Pratik Solanki 2014-07-09 15:27:18 PDT
Comment on attachment 234587 [details]
Patch with build fix

View in context: https://bugs.webkit.org/attachment.cgi?id=234587&action=review

> Source/WebCore/platform/cf/SharedBufferCF.cpp:119
> +    m_size = CFDataGetLength(m_cfData.get());

This function has bugs. We should bail out if size() is not 0 instead of checking for m_buffer.size() - we can have data in m_segments. Also we should not be setting m_size here. When platform data (CFDataRef) is present, m_size is 0 and size() returns the correct value if we have platform data. Updated patch coming up. That may fix the layout test failures.
Comment 8 Pratik Solanki 2014-07-09 17:18:45 PDT
Committed r170938: <http://trac.webkit.org/changeset/170938>