Changeset 168435 in webkit


Ignore:
Timestamp:
May 7, 2014 11:57:35 AM (10 years ago)
Author:
ap@apple.com
Message:

Make blob size computation lazy
https://bugs.webkit.org/show_bug.cgi?id=132653

Reviewed by Anders Carlsson.

Source/WebCore:

  • fileapi/Blob.cpp:

(WebCore::Blob::Blob):
(WebCore::Blob::size):

  • fileapi/Blob.h:

(WebCore::Blob::size): Deleted.

  • fileapi/File.cpp:

(WebCore::File::size): Deleted.

  • fileapi/File.h:
  • fileapi/ThreadableBlobRegistry.cpp:

(WebCore::ThreadableBlobRegistry::registerFileBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
(WebCore::ThreadableBlobRegistry::blobSize):
(WebCore::ThreadableBlobRegistry::unregisterBlobURL):
(WebCore::unregisterBlobURLTask): Deleted.

  • fileapi/ThreadableBlobRegistry.h:
  • platform/network/BlobData.cpp:

(WebCore::BlobData::appendData):

  • platform/network/BlobRegistry.h:
  • platform/network/BlobRegistryImpl.cpp:

(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):

  • platform/network/BlobRegistryImpl.h:

Source/WebKit2:

  • NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:

(WebKit::NetworkBlobRegistry::registerBlobURL):
(WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
(WebKit::NetworkBlobRegistry::blobSize):

  • NetworkProcess/FileAPI/NetworkBlobRegistry.h:
  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::registerBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
(WebKit::NetworkConnectionToWebProcess::blobSize):

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkConnectionToWebProcess.messages.in:
  • WebProcess/FileAPI/BlobRegistryProxy.cpp:

(WebKit::BlobRegistryProxy::registerBlobURL):
(WebKit::BlobRegistryProxy::registerBlobURLForSlice):
(WebKit::BlobRegistryProxy::blobSize):

  • WebProcess/FileAPI/BlobRegistryProxy.h:
Location:
trunk/Source
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168433 r168435  
     12014-05-07  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Make blob size computation lazy
     4        https://bugs.webkit.org/show_bug.cgi?id=132653
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * fileapi/Blob.cpp:
     9        (WebCore::Blob::Blob):
     10        (WebCore::Blob::size):
     11        * fileapi/Blob.h:
     12        (WebCore::Blob::size): Deleted.
     13        * fileapi/File.cpp:
     14        (WebCore::File::size): Deleted.
     15        * fileapi/File.h:
     16        * fileapi/ThreadableBlobRegistry.cpp:
     17        (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
     18        (WebCore::ThreadableBlobRegistry::registerBlobURL):
     19        (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
     20        (WebCore::ThreadableBlobRegistry::blobSize):
     21        (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
     22        (WebCore::unregisterBlobURLTask): Deleted.
     23        * fileapi/ThreadableBlobRegistry.h:
     24        * platform/network/BlobData.cpp:
     25        (WebCore::BlobData::appendData):
     26        * platform/network/BlobRegistry.h:
     27        * platform/network/BlobRegistryImpl.cpp:
     28        (WebCore::BlobRegistryImpl::registerBlobURL):
     29        (WebCore::BlobRegistryImpl::registerBlobURLForSlice):
     30        * platform/network/BlobRegistryImpl.h:
     31
    1322014-05-06  Simon Fraser  <simon.fraser@apple.com>
    233
  • trunk/Source/WebCore/fileapi/Blob.cpp

    r168333 r168435  
    8080Blob::Blob(Vector<char> data, const String& contentType)
    8181    : m_type(contentType)
     82    , m_size(data.size())
    8283{
    8384    Vector<BlobPart> blobParts;
    8485    blobParts.append(BlobPart(std::move(data)));
    8586    m_internalURL = BlobURL::createInternalURL();
    86     m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType);
     87    ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType);
    8788}
    8889
    8990Blob::Blob(Vector<BlobPart> blobParts, const String& contentType)
    9091    : m_type(contentType)
    91 {
    92     m_internalURL = BlobURL::createInternalURL();
    93     m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType);
     92    , m_size(-1)
     93{
     94    m_internalURL = BlobURL::createInternalURL();
     95    ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType);
    9496}
    9597
     
    105107Blob::Blob(const URL& srcURL, long long start, long long end, const String& type)
    106108    : m_type(Blob::normalizedContentType(type))
    107 {
    108     m_internalURL = BlobURL::createInternalURL();
    109     m_size = ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, srcURL, start, end);
     109    , m_size(-1) // size is not necessarily equal to end - start.
     110{
     111    m_internalURL = BlobURL::createInternalURL();
     112    ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, srcURL, start, end);
    110113}
    111114#endif
     
    114117{
    115118    ThreadableBlobRegistry::unregisterBlobURL(m_internalURL);
     119}
     120
     121unsigned long long Blob::size() const
     122{
     123    if (m_size < 0) {
     124        // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to
     125        // come up with an exception to throw if file size is not representable.
     126        unsigned long long actualSize = ThreadableBlobRegistry::blobSize(m_internalURL);
     127        m_size = (actualSize <= std::numeric_limits<long long>::max()) ? static_cast<long long>(actualSize) : 0;
     128    }
     129
     130    return static_cast<unsigned long long>(m_size);
    116131}
    117132
  • trunk/Source/WebCore/fileapi/Blob.h

    r168333 r168435  
    7171    const String& type() const { return m_type; }
    7272
    73     virtual unsigned long long size() const { return static_cast<unsigned long long>(m_size); }
     73    unsigned long long size() const;
    7474    virtual bool isFile() const { return false; }
    7575
     
    114114
    115115    String m_type;
    116     long long m_size;
     116    mutable long long m_size;
    117117};
    118118
  • trunk/Source/WebCore/fileapi/File.cpp

    r168430 r168435  
    7878}
    7979
    80 unsigned long long File::size() const
    81 {
    82     // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to
    83     // come up with an exception to throw if file size is not representable.
    84     long long size;
    85     if (!getFileSize(m_path, size))
    86         return 0;
    87     return static_cast<unsigned long long>(size);
    88 }
    89 
    9080String File::contentTypeFromFilePathOrName(const String& name)
    9181{
  • trunk/Source/WebCore/fileapi/File.h

    r168430 r168435  
    5555    }
    5656
    57     virtual unsigned long long size() const override;
    5857    virtual bool isFile() const override { return true; }
    5958
     
    6160    const String& name() const { return m_name; }
    6261
    63     // This returns the current date and time if the file's last modifiecation date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate).
     62    // This returns the current date and time if the file's last modification date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate).
    6463    double lastModifiedDate() const;
    6564
  • trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp

    r168333 r168435  
    107107        // BlobRegistryContext performs an isolated copy of data.
    108108        BlobRegistryContext* context = new BlobRegistryContext(url, path, contentType);
    109         BinarySemaphore semaphore;
    110109        callOnMainThread([context] {
    111110            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
     
    115114}
    116115
    117 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
    118 {
    119     unsigned long long resultSize;
    120     if (isMainThread())
    121         resultSize = blobRegistry().registerBlobURL(url, std::move(blobParts), contentType);
     116void ThreadableBlobRegistry::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
     117{
     118    if (isMainThread())
     119        blobRegistry().registerBlobURL(url, std::move(blobParts), contentType);
    122120    else {
    123121        // BlobRegistryContext performs an isolated copy of data.
    124122        BlobRegistryContext* context = new BlobRegistryContext(url, std::move(blobParts), contentType);
    125         BinarySemaphore semaphore;
    126         callOnMainThread([context, &semaphore, &resultSize] {
    127             std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
    128             resultSize = blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobParts), blobRegistryContext->contentType);
    129             semaphore.signal();
    130         });
    131         semaphore.wait(std::numeric_limits<double>::max());
    132     }
    133     return resultSize;
     123        callOnMainThread([context] {
     124            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
     125            blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobParts), blobRegistryContext->contentType);
     126        });
     127    }
    134128}
    135129
     
    152146}
    153147
    154 unsigned long long ThreadableBlobRegistry::registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end)
     148void ThreadableBlobRegistry::registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end)
     149{
     150    if (isMainThread())
     151        blobRegistry().registerBlobURLForSlice(newURL, srcURL, start, end);
     152    else {
     153        // BlobRegistryContext performs an isolated copy of data.
     154        BlobRegistryContext* context = new BlobRegistryContext(newURL, srcURL);
     155        callOnMainThread([context, start, end] {
     156            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
     157            blobRegistry().registerBlobURLForSlice(blobRegistryContext->url, blobRegistryContext->srcURL, start, end);
     158        });
     159    }
     160}
     161
     162unsigned long long ThreadableBlobRegistry::blobSize(const URL& url)
    155163{
    156164    unsigned long long resultSize;
    157165    if (isMainThread())
    158         resultSize = blobRegistry().registerBlobURLForSlice(newURL, srcURL, start, end);
    159     else {
    160         // BlobRegistryContext performs an isolated copy of data.
    161         BlobRegistryContext* context = new BlobRegistryContext(newURL, srcURL);
     166        resultSize = blobRegistry().blobSize(url);
     167    else {
     168        // BlobRegistryContext performs an isolated copy of data.
     169        BlobRegistryContext* context = new BlobRegistryContext(url);
    162170        BinarySemaphore semaphore;
    163         callOnMainThread([context, start, end, &semaphore, &resultSize] {
    164             std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
    165             resultSize = blobRegistry().registerBlobURLForSlice(blobRegistryContext->url, blobRegistryContext->srcURL, start, end);
     171        callOnMainThread([context, &semaphore, &resultSize] {
     172            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
     173            resultSize = blobRegistry().blobSize(blobRegistryContext->url);
    166174            semaphore.signal();
    167175        });
     
    169177    }
    170178    return resultSize;
    171 }
    172 
    173 static void unregisterBlobURLTask(void* context)
    174 {
    175     std::unique_ptr<BlobRegistryContext> blobRegistryContext(static_cast<BlobRegistryContext*>(context));
    176     blobRegistry().unregisterBlobURL(blobRegistryContext->url);
    177179}
    178180
     
    184186    if (isMainThread())
    185187        blobRegistry().unregisterBlobURL(url);
    186     else
    187         callOnMainThread(&unregisterBlobURLTask, new BlobRegistryContext(url));
     188    else {
     189        // BlobRegistryContext performs an isolated copy of data.
     190        BlobRegistryContext* context = new BlobRegistryContext(url);
     191        callOnMainThread([context] {
     192            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
     193            blobRegistry().unregisterBlobURL(blobRegistryContext->url);
     194        });
     195    }
    188196}
    189197
     
    199207}
    200208
    201 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL&, Vector<BlobPart>, const String&)
     209void ThreadableBlobRegistry::registerBlobURL(const URL&, Vector<BlobPart>, const String&)
     210{
     211}
     212
     213void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin*, const URL&, const URL&)
     214{
     215}
     216
     217void ThreadableBlobRegistry::registerBlobURLForSlice(const URL&, const URL&, long long, long long)
     218{
     219}
     220
     221void ThreadableBlobRegistry::unregisterBlobURL(const URL&)
     222{
     223}
     224
     225unsigned long long ThreadableBlobRegistry::blobSize(const URL&)
    202226{
    203227    return 0;
    204228}
    205229
    206 void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin*, const URL&, const URL&)
    207 {
    208 }
    209 
    210 unsigned long long ThreadableBlobRegistry::registerBlobURLForSlice(const URL&, const URL&, long long, long long)
     230PassRefPtr<SecurityOrigin> ThreadableBlobRegistry::getCachedOrigin(const URL&)
    211231{
    212232    return 0;
    213233}
    214234
    215 void ThreadableBlobRegistry::unregisterBlobURL(const URL&)
    216 {
    217 }
    218 
    219 PassRefPtr<SecurityOrigin> ThreadableBlobRegistry::getCachedOrigin(const URL&)
    220 {
    221     return 0;
    222 }
    223 
    224235#endif // ENABL(BLOB)
    225236
  • trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h

    r168333 r168435  
    4444public:
    4545    static void registerFileBlobURL(const URL&, const String& path, const String& contentType);
    46     static unsigned long long registerBlobURL(const URL&, Vector<BlobPart> blobParts, const String& contentType);
     46    static void registerBlobURL(const URL&, Vector<BlobPart> blobParts, const String& contentType);
    4747    static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);
     48    static void registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end);
    4849    static void unregisterBlobURL(const URL&);
    4950
    50     static unsigned long long registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end);
     51    static unsigned long long blobSize(const URL&);
    5152
    5253    // Returns the origin for the given blob URL. This is because we are not able to embed the unique security origin or the origin of file URL
  • trunk/Source/WebCore/platform/network/BlobData.cpp

    r168391 r168435  
    7070void BlobData::appendData(PassRefPtr<RawData> data)
    7171{
    72     appendData(data, 0, data->length());
     72    size_t dataSize = data->length();
     73    appendData(data, 0, dataSize);
    7374}
    7475
  • trunk/Source/WebCore/platform/network/BlobRegistry.h

    r168333 r168435  
    5151
    5252    // Registers a blob URL referring to the specified blob data.
    53     virtual unsigned long long registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) = 0;
     53    virtual void registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) = 0;
    5454   
    5555    // Registers a new blob URL referring to the blob data identified by the specified srcURL.
     
    5757
    5858    // Negative start and end values select from the end.
    59     virtual unsigned long long registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) = 0;
     59    virtual void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) = 0;
    6060
    6161    virtual void unregisterBlobURL(const URL&) = 0;
     62
     63    virtual unsigned long long blobSize(const URL&) = 0;
    6264
    6365    virtual bool isBlobRegistryImpl() const { return false; }
  • trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp

    r168391 r168435  
    129129}
    130130
    131 unsigned long long BlobRegistryImpl::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
     131void BlobRegistryImpl::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
    132132{
    133133    ASSERT(isMainThread());
     
    143143    // All the Blob items in the passing blob data are resolved and expanded into a set of Data and File items.
    144144
    145     unsigned long long size = 0;
    146145    for (BlobPart& part : blobParts) {
    147146        switch (part.type()) {
    148147        case BlobPart::Data: {
    149             unsigned long long partSize = part.data().size();
    150148            RefPtr<RawData> rawData = RawData::create(part.moveData());
    151             size += partSize;
    152             blobData->appendData(rawData.release(), 0, partSize);
     149            blobData->appendData(rawData.release());
    153150            break;
    154151        }
    155152        case BlobPart::Blob: {
    156153            if (!m_blobs.contains(part.url().string()))
    157                 return 0;
    158             size += blobSize(part.url());
     154                return;
    159155            for (const BlobDataItem& item : m_blobs.get(part.url().string())->items())
    160156                blobData->m_items.append(item);
     
    165161
    166162    m_blobs.set(url.string(), blobData.release());
    167     return size;
    168163}
    169164
     
    179174}
    180175
    181 unsigned long long BlobRegistryImpl::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
     176void BlobRegistryImpl::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
    182177{
    183178    ASSERT(isMainThread());
    184179    BlobData* originalData = getBlobDataFromURL(srcURL);
    185180    if (!originalData)
    186         return 0;
     181        return;
    187182
    188183    unsigned long long originalSize = blobSize(srcURL);
     
    214209
    215210    m_blobs.set(url.string(), newData.release());
    216     return newLength;
    217211}
    218212
  • trunk/Source/WebCore/platform/network/BlobRegistryImpl.h

    r168382 r168435  
    5959
    6060    virtual void registerFileBlobURL(const WebCore::URL&, const String& path, const String& contentType) override;
    61     virtual unsigned long long registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) override;
     61    virtual void registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) override;
    6262    virtual void registerBlobURL(const URL&, const URL& srcURL) override;
    63     virtual unsigned long long registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) override;
     63    virtual void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) override;
    6464    virtual void unregisterBlobURL(const URL&) override;
    6565    virtual bool isBlobRegistryImpl() const override { return true; }
    6666
    67     unsigned long long blobSize(const URL&);
     67    virtual unsigned long long blobSize(const URL&) override;
    6868
    6969    HashMap<String, RefPtr<BlobData>> m_blobs;
  • trunk/Source/WebKit2/ChangeLog

    r168433 r168435  
     12014-05-07  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Make blob size computation lazy
     4        https://bugs.webkit.org/show_bug.cgi?id=132653
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
     9        (WebKit::NetworkBlobRegistry::registerBlobURL):
     10        (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
     11        (WebKit::NetworkBlobRegistry::blobSize):
     12        * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
     13        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     14        (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
     15        (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
     16        (WebKit::NetworkConnectionToWebProcess::blobSize):
     17        * NetworkProcess/NetworkConnectionToWebProcess.h:
     18        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
     19        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
     20        (WebKit::BlobRegistryProxy::registerBlobURL):
     21        (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
     22        (WebKit::BlobRegistryProxy::blobSize):
     23        * WebProcess/FileAPI/BlobRegistryProxy.h:
     24
    1252014-05-06  Simon Fraser  <simon.fraser@apple.com>
    226
  • trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp

    r168333 r168435  
    6969}
    7070
    71 uint64_t NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, Vector<WebCore::BlobPart> blobParts, const String& contentType)
     71void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, Vector<WebCore::BlobPart> blobParts, const String& contentType)
    7272{
    7373    ASSERT(!m_sandboxExtensions.contains(url.string()));
     
    8080    }
    8181
    82     uint64_t resultSize = blobRegistry().registerBlobURL(url, std::move(blobParts), contentType);
     82    blobRegistry().registerBlobURL(url, std::move(blobParts), contentType);
    8383
    8484    if (!sandboxExtensions.isEmpty())
     
    9090        mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator;
    9191    mapIterator->value.add(url);
    92 
    93     return resultSize;
    9492}
    9593
     
    106104}
    107105
    108 uint64_t NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess* connection, const WebCore::URL& url, const WebCore::URL& srcURL, int64_t start, int64_t end)
     106void NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess* connection, const WebCore::URL& url, const WebCore::URL& srcURL, int64_t start, int64_t end)
    109107{
    110     uint64_t resultSize = blobRegistry().registerBlobURLForSlice(url, srcURL, start, end);
     108    blobRegistry().registerBlobURLForSlice(url, srcURL, start, end);
    111109
    112110    // FIXME: Only store extensions for files that the slice actually contains, not for all the files in original blob.
     
    118116    ASSERT(m_blobsForConnection.find(connection)->value.contains(srcURL));
    119117    m_blobsForConnection.find(connection)->value.add(url);
    120 
    121     return resultSize;
    122118}
    123119
     
    130126    ASSERT(m_blobsForConnection.find(connection)->value.contains(url));
    131127    m_blobsForConnection.find(connection)->value.remove(url);
     128}
     129
     130uint64_t NetworkBlobRegistry::blobSize(NetworkConnectionToWebProcess* connection, const WebCore::URL& url)
     131{
     132    if (!m_blobsForConnection.contains(connection) || !m_blobsForConnection.find(connection)->value.contains(url))
     133        return 0;
     134
     135    return blobRegistry().blobSize(url);
    132136}
    133137
  • trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h

    r168333 r168435  
    4949
    5050    void registerFileBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const String& path, PassRefPtr<SandboxExtension>, const String& contentType);
    51     uint64_t registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType);
     51    void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType);
    5252    void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL);
    53     uint64_t registerBlobURLForSlice(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end);
     53    void registerBlobURLForSlice(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end);
    5454    void unregisterBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&);
     55    uint64_t blobSize(NetworkConnectionToWebProcess*, const WebCore::URL&);
    5556
    5657    void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*);
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r168333 r168435  
    231231}
    232232
    233 void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType, uint64_t& resultSize)
    234 {
    235     resultSize = NetworkBlobRegistry::shared().registerBlobURL(this, url, std::move(blobParts), contentType);
     233void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
     234{
     235    NetworkBlobRegistry::shared().registerBlobURL(this, url, std::move(blobParts), contentType);
    236236}
    237237
     
    241241}
    242242
    243 void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end, uint64_t& resultSize)
    244 {
    245     resultSize = NetworkBlobRegistry::shared().registerBlobURLForSlice(this, url, srcURL, start, end);
     243void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end)
     244{
     245    NetworkBlobRegistry::shared().registerBlobURLForSlice(this, url, srcURL, start, end);
    246246}
    247247
     
    250250    NetworkBlobRegistry::shared().unregisterBlobURL(this, url);
    251251}
     252
     253void NetworkConnectionToWebProcess::blobSize(const URL& url, uint64_t& resultSize)
     254{
     255    resultSize = NetworkBlobRegistry::shared().blobSize(this, url);
     256}
    252257#endif
    253258
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h

    r168333 r168435  
    8989#if ENABLE(BLOB)
    9090    void registerFileBlobURL(const WebCore::URL&, const String& path, const SandboxExtension::Handle&, const String& contentType);
    91     void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType, uint64_t& resultSize);
     91    void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType);
    9292    void registerBlobURLFromURL(const WebCore::URL&, const WebCore::URL& srcURL);
    93     void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end, uint64_t& resultSize);
     93    void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end);
     94    void blobSize(const WebCore::URL&, uint64_t& resultSize);
    9495    void unregisterBlobURL(const WebCore::URL&);
    9596#endif
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in

    r168333 r168435  
    4646#if ENABLE(BLOB)
    4747    RegisterFileBlobURL(WebCore::URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
    48     RegisterBlobURL(WebCore::URL url, Vector<WebCore::BlobPart> blobParts, String contentType) -> (uint64_t resultSize)
     48    RegisterBlobURL(WebCore::URL url, Vector<WebCore::BlobPart> blobParts, String contentType)
    4949    RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL)
    50     RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end) -> (uint64_t resultSize)
     50    RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end)
    5151    UnregisterBlobURL(WebCore::URL url)
     52    BlobSize(WebCore::URL url) -> (uint64_t resultSize)
    5253#endif
    5354}
  • trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp

    r168333 r168435  
    5151}
    5252
    53 unsigned long long BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
     53void BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
    5454{
    5555    ASSERT(WebProcess::shared().usesNetworkProcess());
    5656
    57     uint64_t resultSize;
    58     if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), Messages::NetworkConnectionToWebProcess::RegisterBlobURL::Reply(resultSize), 0))
    59         return 0;
    60     return resultSize;
     57    WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), 0);
    6158}
    6259
     
    7572}
    7673
    77 unsigned long long BlobRegistryProxy::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
     74void BlobRegistryProxy::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
     75{
     76    ASSERT(WebProcess::shared().usesNetworkProcess());
     77
     78    WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end), 0);
     79}
     80
     81unsigned long long BlobRegistryProxy::blobSize(const URL& url)
    7882{
    7983    ASSERT(WebProcess::shared().usesNetworkProcess());
    8084
    8185    uint64_t resultSize;
    82     if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end), Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice::Reply(resultSize), 0))
     86    if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::BlobSize(url), Messages::NetworkConnectionToWebProcess::BlobSize::Reply(resultSize), 0))
    8387        return 0;
    8488    return resultSize;
  • trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h

    r168333 r168435  
    3636public:
    3737    virtual void registerFileBlobURL(const WebCore::URL&, const String& path, const String& contentType) override;
    38     virtual unsigned long long registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType) override;
     38    virtual void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType) override;
    3939    virtual void registerBlobURL(const WebCore::URL&, const WebCore::URL& srcURL) override;
    4040    virtual void unregisterBlobURL(const WebCore::URL&) override;
    41     virtual unsigned long long registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, long long start, long long end) override;
     41    virtual void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, long long start, long long end) override;
     42    virtual unsigned long long blobSize(const WebCore::URL&) override;
    4243};
    4344
Note: See TracChangeset for help on using the changeset viewer.