Changeset 88486 in webkit


Ignore:
Timestamp:
Jun 9, 2011 2:45:18 PM (13 years ago)
Author:
jcivelli@chromium.org
Message:

2011-06-09 Jay Civelli <jcivelli@chromium.org>

Reviewed by Darin Fisher.

Page serializer APIs now use WebData instead of fetching the entire
resource contents.
https://bugs.webkit.org/show_bug.cgi?id=61908

  • public/WebData.h:
  • public/WebPageSerializer.h:
  • src/WebData.cpp: (WebKit::WebData::getSomeData):
  • src/WebPageSerializer.cpp: (WebKit::WebPageSerializer::serialize): (WebKit::WebPageSerializer::serializeToMHTML):
Location:
trunk/Source/WebKit/chromium
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r88466 r88486  
     12011-06-09  Jay Civelli  <jcivelli@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Page serializer APIs now use WebData instead of fetching the entire
     6        resource contents.
     7        https://bugs.webkit.org/show_bug.cgi?id=61908
     8
     9        * public/WebData.h:
     10        * public/WebPageSerializer.h:
     11        * src/WebData.cpp:
     12        (WebKit::WebData::getSomeData):
     13        * src/WebPageSerializer.cpp:
     14        (WebKit::WebPageSerializer::serialize):
     15        (WebKit::WebPageSerializer::serializeToMHTML):
     16
    1172011-06-09  Bill Budge  <bbudge@chromium.org>
    218
  • trunk/Source/WebKit/chromium/public/WebData.h

    r50680 r88486  
    7777
    7878    WEBKIT_API size_t size() const;
     79
     80    // Sets |data| to point to the content of the WebData at index |position|
     81    // and returns the number of bytes available to be read in |data|.
     82    // Return 0 when no more data is left.
     83    // Usage:
     84    //      const char* segment;
     85    //      size_t position = 0;
     86    //      while (size_t length = webData.getSomeData(segment, position)) {
     87    //          // Use the data. for example: decoder->decode(segment, length);
     88    //          position += length;
     89    //      }
     90    WEBKIT_API size_t getSomeData(const char*& data, size_t position) const;
     91
     92    // Returns all the data from the SharedBuffer.
     93    // Consider using getSomeData() as data() could require flattening the internal buffer
     94    // which might be expensive.
    7995    WEBKIT_API const char* data() const;
    8096
  • trunk/Source/WebKit/chromium/public/WebPageSerializer.h

    r87958 r88486  
    3434#include "WebCString.h"
    3535#include "WebCommon.h"
     36#include "WebData.h"
    3637#include "WebURL.h"
    3738
     
    5051        WebURL url;
    5152        WebCString mimeType;
    52         WebCString data;
     53        WebData data;
    5354    };
    5455
     
    6061
    6162    // Serializes the WebView contents to a MHTML representation.
    62     WEBKIT_API static WebCString serializeToMHTML(WebView*);
     63    WEBKIT_API static WebData serializeToMHTML(WebView*);
    6364
    6465    // IMPORTANT:
  • trunk/Source/WebKit/chromium/src/WebData.cpp

    r50719 r88486  
    7070}
    7171
     72size_t WebData::getSomeData(const char*& data, size_t position) const
     73{
     74    return m_private->getSomeData(data, position);
     75}
     76
    7277const char* WebData::data() const
    7378{
  • trunk/Source/WebKit/chromium/src/WebPageSerializer.cpp

    r87958 r88486  
    194194        resource.url = iter->url;
    195195        resource.mimeType = iter->mimeType.ascii();
    196         // FIXME: we are copying all the resource data here. Idealy we would have a WebSharedData().
    197         resource.data = WebCString(iter->data->data(), iter->data->size());
     196        resource.data = iter->data;
    198197        result.append(resource);
    199198    }
    200 
    201199    *resourcesParam = result;         
    202200}
    203201
    204 WebCString WebPageSerializer::serializeToMHTML(WebView* view)
    205 {
    206     RefPtr<SharedBuffer> mhtml = MHTMLArchive::generateMHTMLData(static_cast<WebViewImpl*>(view)->page());
    207     // FIXME: we are copying all the data here. Idealy we would have a WebSharedData().
    208     return WebCString(mhtml->data(), mhtml->size());
     202WebData WebPageSerializer::serializeToMHTML(WebView* view)
     203{
     204    return MHTMLArchive::generateMHTMLData(static_cast<WebViewImpl*>(view)->page());
    209205}
    210206
Note: See TracChangeset for help on using the changeset viewer.