Make in-memory blobs work in NetworkProcess
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Mar 2013 22:00:57 +0000 (22:00 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Mar 2013 22:00:57 +0000 (22:00 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=111132

        Reviewed by Sam Weinig.

        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
        (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
        (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
        (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
        * NetworkProcess/NetworkConnectionToWebProcess.h:
        Implement BlobRegistry interface by using BlobRegistryImpl (same one as used in
        WebProcess in non-PPT mode).

        * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Added three messages
        needed for BlobRegistry.

        * NetworkProcess/NetworkProcess.cpp:
        * NetworkProcess/NetworkProcessPlatformStrategies.cpp: Added.
        * NetworkProcess/NetworkProcessPlatformStrategies.h: Added.
        Added a mostly empty platform strategy, just for FormData to talk to BlobRegistry.
        Perhaps we'll find a way to avoid this WebCore code path in NetworkProcess, because
        we obviously know which registry implementation is in use in this process.

        * Shared/FileAPI: Added.
        * Shared/FileAPI/BlobRegistrationData.cpp: Added.
        * Shared/FileAPI/BlobRegistrationData.h: Added.
        Added a class for passing BlobData and extension handles over IPC.
        This uses a trick with mutable a member to avoid copying decoded BlobStorageData.

        * WebKit2.xcodeproj/project.pbxproj:
        * WebProcess/FileAPI: Added.
        * WebProcess/FileAPI/BlobRegistryProxy.cpp: Added.
        * WebProcess/FileAPI/BlobRegistryProxy.h: Added.
        A proxy implementation of BlobRegistry that just sends requests over IPC. We only
        need async ones.

        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
        (WebKit::WebPlatformStrategies::createBlobRegistry):
        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
        Create an appropriate BlobRegistry.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144499 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp [new file with mode: 0644]
Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h [new file with mode: 0644]
Source/WebKit2/Shared/FileAPI/BlobRegistrationData.cpp [new file with mode: 0644]
Source/WebKit2/Shared/FileAPI/BlobRegistrationData.h [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

index f431eb8..fa393d4 100644 (file)
@@ -1,3 +1,15 @@
+2013-03-01  Alexey Proskuryakov  <ap@apple.com>
+
+        Make in-memory blobs work in NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=111132
+
+        Reviewed by Sam Weinig.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        Exported functions now needed by WebKit2, and made some headers Private instead
+        of Project.
+
 2013-03-01  Eric Seidel  <eric@webkit.org>
 
         Threaded HTML Parser has an extra copy of every byte from the network
index f6f2304..0972c77 100644 (file)
@@ -311,7 +311,6 @@ __ZN7WebCore14FrameSelection5clearEv
 __ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityENS_14EUserTriggeredE
 __ZN7WebCore14FrameSelection9selectAllEv
 __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
-__ZN7WebCore14LoaderStrategy18createBlobRegistryEv
 __ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
 __ZN7WebCore14LoaderStrategy25loadResourceSynchronouslyEPNS_17NetworkingContextEmRKNS_15ResourceRequestENS_17StoredCredentialsERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0EEE
 __ZN7WebCore14PluginDocument10pluginNodeEv
@@ -2307,6 +2306,20 @@ __ZN7WebCore12SchedulePairC1EP9NSRunLoopPK10__CFString
 __ZN7WebCore14ResourceHandle12releaseProxyEv
 #endif
 
+#if ENABLE(BLOB)
+__ZN7WebCore12blobRegistryEv
+__ZN7WebCore14LoaderStrategy18createBlobRegistryEv
+__ZN7WebCore7RawDataC1Ev
+__ZN7WebCore8BlobData10appendBlobERKNS_4KURLExx
+__ZN7WebCore8BlobData10appendDataEN3WTF10PassRefPtrINS_7RawDataEEExx
+__ZN7WebCore8BlobData10appendFileERKN3WTF6StringExxd
+__ZN7WebCore8BlobData6createEv
+__ZN7WebCore12BlobDataItem11toEndOfFileE
+__ZN7WebCore12BlobRegistryD2Ev
+__ZTVN7WebCore12BlobRegistryE
+__ZTVN7WebCore16BlobRegistryImplE
+#endif
+
 #if ENABLE(CONTEXT_MENUS)
 __ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
 __ZN7WebCore12EventHandler20sendContextMenuEventERKNS_18PlatformMouseEventE
index d67d569..a70984b 100644 (file)
                2ED609BC1145B07100C8684E /* DOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ED609BA1145B07100C8684E /* DOMFormData.cpp */; };
                2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED609BB1145B07100C8684E /* DOMFormData.h */; };
                2EDEF1F3121B0EFC00726DB2 /* BlobData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEF1ED121B0EFC00726DB2 /* BlobData.cpp */; };
-               2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */; };
-               2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */; };
+               2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEF1F0121B0EFC00726DB2 /* BlobRegistryImpl.cpp */; };
-               2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */; };
-               2EDEF1F8121B0EFC00726DB2 /* BlobStorageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F2121B0EFC00726DB2 /* BlobStorageData.h */; };
+               2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2EDEF1F8121B0EFC00726DB2 /* BlobStorageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F2121B0EFC00726DB2 /* BlobStorageData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EDF369C122C94B4002F7D4E /* FileReaderSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EDF369A122C94B4002F7D4E /* FileReaderSync.cpp */; };
                2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369B122C94B4002F7D4E /* FileReaderSync.h */; };
                2EDF369F122C94C8002F7D4E /* FileException.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369E122C94C8002F7D4E /* FileException.h */; };
index 8579538..66ee1fd 100644 (file)
@@ -1,3 +1,46 @@
+2013-02-28  Alexey Proskuryakov  <ap@apple.com>
+
+        Make in-memory blobs work in NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=111132
+
+        Reviewed by Sam Weinig.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
+        (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        Implement BlobRegistry interface by using BlobRegistryImpl (same one as used in
+        WebProcess in non-PPT mode).
+
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Added three messages
+        needed for BlobRegistry.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        * NetworkProcess/NetworkProcessPlatformStrategies.cpp: Added.
+        * NetworkProcess/NetworkProcessPlatformStrategies.h: Added.
+        Added a mostly empty platform strategy, just for FormData to talk to BlobRegistry.
+        Perhaps we'll find a way to avoid this WebCore code path in NetworkProcess, because
+        we obviously know which registry implementation is in use in this process.
+
+        * Shared/FileAPI: Added.
+        * Shared/FileAPI/BlobRegistrationData.cpp: Added.
+        * Shared/FileAPI/BlobRegistrationData.h: Added.
+        Added a class for passing BlobData and extension handles over IPC.
+        This uses a trick with mutable a member to avoid copying decoded BlobStorageData.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/FileAPI: Added.
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp: Added.
+        * WebProcess/FileAPI/BlobRegistryProxy.h: Added.
+        A proxy implementation of BlobRegistry that just sends requests over IPC. We only
+        need async ones.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::createBlobRegistry):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+        Create an appropriate BlobRegistry.
+
 2013-03-01  Zan Dobersek  <zdobersek@igalia.com>
 
         Uncomment ENABLE_SVG guards to avoid having WebKitPluginProcess link
index 0d1b644..a94c039 100644 (file)
 #include "config.h"
 #include "NetworkConnectionToWebProcess.h"
 
+#include "BlobRegistrationData.h"
 #include "ConnectionStack.h"
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcess.h"
 #include "NetworkResourceLoader.h"
 #include "RemoteNetworkingContext.h"
 #include "SyncNetworkResourceLoader.h"
+#include <WebCore/BlobData.h>
+#include <WebCore/BlobRegistry.h>
 #include <WebCore/PlatformCookieJar.h>
 #include <WebCore/ResourceLoaderOptions.h>
 #include <WebCore/ResourceRequest.h>
@@ -177,6 +180,23 @@ void NetworkConnectionToWebProcess::deleteCookie(bool privateBrowsingEnabled, co
     WebCore::deleteCookie(storageSession(privateBrowsingEnabled), url, cookieName);
 }
 
+void NetworkConnectionToWebProcess::registerBlobURL(const KURL& url, const BlobRegistrationData& data)
+{
+    // FIXME: Track sandbox extensions.
+    // FIXME: unregister all URLs when process connection closes.
+    blobRegistry().registerBlobURL(url, data.releaseData());
+}
+
+void NetworkConnectionToWebProcess::registerBlobURLFromURL(const KURL& url, const KURL& srcURL)
+{
+    blobRegistry().registerBlobURL(url, srcURL);
+}
+
+void NetworkConnectionToWebProcess::unregisterBlobURL(const KURL& url)
+{
+    blobRegistry().unregisterBlobURL(url);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(NETWORK_PROCESS)
index 734097d..f06c42f 100644 (file)
@@ -41,6 +41,7 @@ class ResourceRequest;
 
 namespace WebKit {
 
+class BlobRegistrationData;
 class NetworkConnectionToWebProcess;
 class NetworkResourceLoader;
 class SyncNetworkResourceLoader;
@@ -83,6 +84,10 @@ private:
     void getRawCookies(bool privateBrowsingEnabled, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
     void deleteCookie(bool privateBrowsingEnabled, const WebCore::KURL&, const String& cookieName);
 
+    void registerBlobURL(const WebCore::KURL&, const BlobRegistrationData&);
+    void registerBlobURLFromURL(const WebCore::KURL&, const WebCore::KURL& srcURL);
+    void unregisterBlobURL(const WebCore::KURL&);
+
     RefPtr<CoreIPC::Connection> m_connection;
 
     HashMap<ResourceLoadIdentifier, RefPtr<NetworkResourceLoader> > m_networkResourceLoaders;
index f2ff2c3..98f5b4f 100644 (file)
@@ -40,6 +40,10 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     CookieRequestHeaderFieldValue(bool privateBrowsingEnabled, WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::String result)
     GetRawCookies(bool privateBrowsingEnabled, WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::Vector<WebCore::Cookie> cookies)
     DeleteCookie(bool privateBrowsingEnabled, WebCore::KURL url, WTF::String cookieName)
+
+    RegisterBlobURL(WebCore::KURL url, WebKit::BlobRegistrationData data)
+    RegisterBlobURLFromURL(WebCore::KURL url, WebCore::KURL srcURL)
+    UnregisterBlobURL(WebCore::KURL url)
 }
 
 #endif // ENABLE(NETWORK_PROCESS)
index acefca6..27876a6 100644 (file)
@@ -35,6 +35,7 @@
 #include "Logging.h"
 #include "NetworkConnectionToWebProcess.h"
 #include "NetworkProcessCreationParameters.h"
+#include "NetworkProcessPlatformStrategies.h"
 #include "NetworkProcessProxyMessages.h"
 #include "RemoteNetworkingContext.h"
 #include "StatisticsData.h"
@@ -63,6 +64,8 @@ NetworkProcess::NetworkProcess()
     : m_hasSetCacheModel(false)
     , m_cacheModel(CacheModelDocumentViewer)
 {
+    NetworkProcessPlatformStrategies::initialize();
+
     addSupplement<AuthenticationManager>();
     addSupplement<WebCookieManager>();
     addSupplement<CustomProtocolManager>();
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp b/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp
new file mode 100644 (file)
index 0000000..6907309
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcessPlatformStrategies.h"
+
+#include <WebCore/BlobRegistryImpl.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void NetworkProcessPlatformStrategies::initialize()
+{
+    DEFINE_STATIC_LOCAL(NetworkProcessPlatformStrategies, platformStrategies, ());
+    setPlatformStrategies(&platformStrategies);
+}
+
+CookiesStrategy* NetworkProcessPlatformStrategies::createCookiesStrategy()
+{
+    return 0;
+}
+
+DatabaseStrategy* NetworkProcessPlatformStrategies::createDatabaseStrategy()
+{
+    return 0;
+}
+
+LoaderStrategy* NetworkProcessPlatformStrategies::createLoaderStrategy()
+{
+    return this;
+}
+
+PasteboardStrategy* NetworkProcessPlatformStrategies::createPasteboardStrategy()
+{
+    return 0;
+}
+
+PluginStrategy* NetworkProcessPlatformStrategies::createPluginStrategy()
+{
+    return 0;
+}
+
+SharedWorkerStrategy* NetworkProcessPlatformStrategies::createSharedWorkerStrategy()
+{
+    return 0;
+}
+
+StorageStrategy* NetworkProcessPlatformStrategies::createStorageStrategy()
+{
+    return 0;
+}
+
+VisitedLinkStrategy* NetworkProcessPlatformStrategies::createVisitedLinkStrategy()
+{
+    return 0;
+}
+
+ResourceLoadScheduler* NetworkProcessPlatformStrategies::resourceLoadScheduler()
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+void NetworkProcessPlatformStrategies::loadResourceSynchronously(NetworkingContext*, unsigned long resourceLoadIdentifier, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data)
+{
+    ASSERT_NOT_REACHED();
+}
+
+#if ENABLE(BLOB)
+BlobRegistry* NetworkProcessPlatformStrategies::createBlobRegistry()
+{
+    return new BlobRegistryImpl;
+}
+
+#endif
+
+
+}
diff --git a/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h b/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h
new file mode 100644 (file)
index 0000000..066e79d
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkProcessPlatformStrategies_h
+#define NetworkProcessPlatformStrategies_h
+
+#include <WebCore/LoaderStrategy.h>
+#include <WebCore/PlatformStrategies.h>
+
+namespace WebKit {
+
+class NetworkProcessPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::LoaderStrategy {
+public:
+    static void initialize();
+    
+private:
+    // WebCore::PlatformStrategies
+    virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE;
+    virtual WebCore::DatabaseStrategy* createDatabaseStrategy() OVERRIDE;
+    virtual WebCore::LoaderStrategy* createLoaderStrategy() OVERRIDE;
+    virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE;
+    virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE;
+    virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() OVERRIDE;
+    virtual WebCore::StorageStrategy* createStorageStrategy() OVERRIDE;
+    virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE;
+
+    // WebCore::LoaderStrategy
+    virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() OVERRIDE;
+    virtual void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) OVERRIDE;
+#if ENABLE(BLOB)
+    virtual WebCore::BlobRegistry* createBlobRegistry() OVERRIDE;
+#endif
+};
+
+} // namespace WebKit
+
+
+#endif // NetworkProcessPlatformStrategies_h
diff --git a/Source/WebKit2/Shared/FileAPI/BlobRegistrationData.cpp b/Source/WebKit2/Shared/FileAPI/BlobRegistrationData.cpp
new file mode 100644 (file)
index 0000000..59b410a
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BlobRegistrationData.h"
+
+#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#include "ArgumentCoders.h"
+#include "DataReference.h"
+#include "WebCoreArgumentCoders.h"
+#include <WebCore/BlobData.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+BlobRegistrationData::BlobRegistrationData()
+{
+}
+
+BlobRegistrationData::BlobRegistrationData(PassOwnPtr<BlobData> data)
+    : m_data(data)
+{
+    const BlobDataItemList& items = m_data->items();
+    size_t fileCount = 0;
+    for (size_t i = 0, count = items.size(); i < count; ++i) {
+        if (items[i].type == BlobDataItem::File)
+            ++fileCount;
+    }
+
+    SandboxExtension::HandleArray sandboxExtensions;
+    sandboxExtensions.allocate(fileCount);
+    size_t extensionIndex = 0;
+    for (size_t i = 0, count = items.size(); i < count; ++i) {
+        const BlobDataItem& item = items[i];
+        if (item.type == BlobDataItem::File)
+            SandboxExtension::createHandle(item.path, SandboxExtension::ReadOnly, sandboxExtensions[extensionIndex++]);
+    }
+}
+
+BlobRegistrationData::~BlobRegistrationData()
+{
+}
+
+PassOwnPtr<BlobData> BlobRegistrationData::releaseData() const
+{
+    return m_data.release();
+}
+
+void BlobRegistrationData::encode(CoreIPC::ArgumentEncoder& encoder) const
+{
+    encoder << m_data->contentType();
+    encoder << m_data->contentDisposition();
+
+    const BlobDataItemList& items = m_data->items();
+    encoder << static_cast<uint64_t>(items.size());
+    for (size_t i = 0, count = items.size(); i < count; ++i) {
+        const BlobDataItem& item = items[i];
+        encoder << static_cast<uint32_t>(item.type);
+        switch (item.type) {
+        case BlobDataItem::Data:
+            // There is no way to create a partial data item.
+            ASSERT(!item.offset);
+            ASSERT(item.length == BlobDataItem::toEndOfFile);
+            encoder << CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(item.data->data()), item.data->length());
+            break;
+        case BlobDataItem::File:
+            encoder << item.offset;
+            encoder << item.length;
+            encoder << item.expectedModificationTime;
+            encoder << item.path;
+            break;
+        case BlobDataItem::Blob:
+            encoder << item.offset;
+            encoder << item.length;
+            encoder << item.url;
+            break;
+        }
+    }
+
+    encoder << m_sandboxExtensions;
+}
+
+bool BlobRegistrationData::decode(CoreIPC::ArgumentDecoder& decoder, BlobRegistrationData& result)
+{
+    ASSERT(!result.m_data);
+    result.m_data = BlobData::create();
+
+    String contentType;
+    if (!decoder.decode(contentType))
+        return false;
+    result.m_data->setContentType(contentType);
+
+    String contentDisposition;
+    if (!decoder.decode(contentDisposition))
+        return false;
+    result.m_data->setContentDisposition(contentDisposition);
+
+    uint64_t itemCount;
+    if (!decoder.decode(itemCount))
+        return false;
+
+    for (uint64_t i = 0; i < itemCount; ++i) {
+        uint32_t type;
+        if (!decoder.decode(type))
+            return false;
+        switch (type) {
+        case BlobDataItem::Data: {
+            CoreIPC::DataReference data;
+            if (!decoder.decode(data))
+                return false;
+            RefPtr<RawData> rawData = RawData::create();
+            rawData->mutableData()->append(data.data(), data.size());
+            result.m_data->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile);
+            break;
+        }
+        case BlobDataItem::File: {
+            long long offset;
+            if (!decoder.decode(offset))
+                return false;
+            long long length;
+            if (!decoder.decode(length))
+                return false;
+            double expectedModificationTime;
+            if (!decoder.decode(expectedModificationTime))
+                return false;
+            String path;
+            if (!decoder.decode(path))
+                return false;
+            result.m_data->appendFile(path, offset, length, expectedModificationTime);
+            break;
+        }
+        case BlobDataItem::Blob: {
+            long long offset;
+            if (!decoder.decode(offset))
+                return false;
+            long long length;
+            if (!decoder.decode(length))
+                return false;
+            String url;
+            if (!decoder.decode(url))
+                return false;
+            result.m_data->appendBlob(KURL(KURL(), url), offset, length);
+            break;
+        }
+        default:
+            return false;
+        }
+    }
+
+    if (!decoder.decode(result.m_sandboxExtensions))
+        return false;
+
+    return true;
+}
+
+}
+
+#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
diff --git a/Source/WebKit2/Shared/FileAPI/BlobRegistrationData.h b/Source/WebKit2/Shared/FileAPI/BlobRegistrationData.h
new file mode 100644 (file)
index 0000000..35f6abb
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobRegistrationData_h
+#define BlobRegistrationData_h
+
+#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#include "SandboxExtension.h"
+
+namespace WebCore {
+class BlobData;
+}
+
+namespace WebKit {
+
+class BlobRegistrationData {
+WTF_MAKE_NONCOPYABLE(BlobRegistrationData);
+public:
+    BlobRegistrationData();
+    BlobRegistrationData(PassOwnPtr<WebCore::BlobData>);
+    ~BlobRegistrationData();
+
+    void encode(CoreIPC::ArgumentEncoder&) const;
+    static bool decode(CoreIPC::ArgumentDecoder&, BlobRegistrationData&);
+
+    PassOwnPtr<WebCore::BlobData> releaseData() const;
+    const SandboxExtension::HandleArray& sandboxExtensions() const { return m_sandboxExtensions; }
+
+private:
+    mutable OwnPtr<WebCore::BlobData> m_data;
+    SandboxExtension::HandleArray m_sandboxExtensions;
+};
+
+}
+
+#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#endif // BlobRegistrationData_h
index 140ed5c..f681208 100644 (file)
                E133FD8A1423DD7F00FC7BFB /* WebKit.icns in Resources */ = {isa = PBXBuildFile; fileRef = E133FD891423DD7F00FC7BFB /* WebKit.icns */; };
                E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */ = {isa = PBXBuildFile; fileRef = E134F01512EA5D11004EC58D /* WKPrintingView.h */; };
                E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E134F01912EA5D99004EC58D /* WKPrintingView.mm */; };
+               E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */; };
+               E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */; };
                E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */; };
                E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E1513C65166EABB200149FCB /* ChildProcessProxy.h */; };
+               E170876B16D6CA6900F99226 /* BlobRegistryProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E170876916D6CA6900F99226 /* BlobRegistryProxy.cpp */; };
+               E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E170876A16D6CA6900F99226 /* BlobRegistryProxy.h */; };
+               E170877016D6CFE500F99226 /* BlobRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */; };
+               E170877116D6CFE500F99226 /* BlobRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = E170876F16D6CFE500F99226 /* BlobRegistrationData.h */; };
                E179088D169BAA62006904C7 /* SecItemShim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6947169B77C8009B6670 /* SecItemShim.cpp */; };
                E179088F169BAA6A006904C7 /* SecItemShim.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6948169B77C8009B6670 /* SecItemShim.h */; };
                E1790890169BAA7F006904C7 /* SecItemShimMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6911169B667B009B6670 /* SecItemShimMessageReceiver.cpp */; };
                1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
                1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
                1A334DEA16DE8B68006A8E38 /* StorageAreaProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageAreaProxy.messages.in; sourceTree = "<group>"; };
-               1A334DEB16DE8F88006A8E38 /* StorageAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageAreaProxyMessageReceiver.cpp; path = StorageAreaProxyMessageReceiver.cpp; sourceTree = "<group>"; };
-               1A334DEC16DE8F88006A8E38 /* StorageAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageAreaProxyMessages.h; path = StorageAreaProxyMessages.h; sourceTree = "<group>"; };
+               1A334DEB16DE8F88006A8E38 /* StorageAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaProxyMessageReceiver.cpp; sourceTree = "<group>"; };
+               1A334DEC16DE8F88006A8E38 /* StorageAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaProxyMessages.h; sourceTree = "<group>"; };
                1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginModuleInfo.cpp; sourceTree = "<group>"; };
                1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginModuleInfo.h; sourceTree = "<group>"; };
                1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentCoders.cpp; sourceTree = "<group>"; };
                E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; };
                E13A8A2C162879AC00392929 /* SharedWorkerProcess.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SharedWorkerProcess.app; sourceTree = BUILT_PRODUCTS_DIR; };
                E13A8A4B16287A1B00392929 /* SharedWorkerProcess.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SharedWorkerProcess.xcconfig; sourceTree = "<group>"; };
+               E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessPlatformStrategies.cpp; path = NetworkProcess/NetworkProcessPlatformStrategies.cpp; sourceTree = "<group>"; };
+               E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessPlatformStrategies.h; path = NetworkProcess/NetworkProcessPlatformStrategies.h; sourceTree = "<group>"; };
                E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcessProxy.cpp; sourceTree = "<group>"; };
                E1513C65166EABB200149FCB /* ChildProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessProxy.h; sourceTree = "<group>"; };
+               E170876916D6CA6900F99226 /* BlobRegistryProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobRegistryProxy.cpp; path = WebProcess/FileAPI/BlobRegistryProxy.cpp; sourceTree = "<group>"; };
+               E170876A16D6CA6900F99226 /* BlobRegistryProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobRegistryProxy.h; path = WebProcess/FileAPI/BlobRegistryProxy.h; sourceTree = "<group>"; };
+               E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobRegistrationData.cpp; path = FileAPI/BlobRegistrationData.cpp; sourceTree = "<group>"; };
+               E170876F16D6CFE500F99226 /* BlobRegistrationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobRegistrationData.h; path = FileAPI/BlobRegistrationData.h; sourceTree = "<group>"; };
                E179FD9B134D38060015B883 /* ArgumentCodersMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCodersMac.h; sourceTree = "<group>"; };
                E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArgumentCodersMac.mm; sourceTree = "<group>"; };
                E17AE2C116B9C139001C42F1 /* com.apple.WebKit.NetworkProcess.sb.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = com.apple.WebKit.NetworkProcess.sb.in; sourceTree = "<group>"; };
                                BC111B5F112F635E00337BAB /* CoreIPCSupport */,
                                518E8EF216B208F800E91429 /* Downloads */,
                                BC82836816B3587900A278FE /* EntryPointUtilities */,
+                               E170877216D6CFEC00F99226 /* FileAPI */,
                                BC111B5A112F628200337BAB /* mac */,
                                51A8A60D1627F2AC000D90E9 /* Network */,
                                BCAF35E516CA253B00D4E9FC /* OfflineStorage */,
                                513A164B1630A9BF005D7D22 /* NetworkConnectionToWebProcess.messages.in */,
                                510CC7DF16138E2900D03ED3 /* NetworkProcess.cpp */,
                                510CC7E016138E2900D03ED3 /* NetworkProcess.h */,
+                               E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */,
+                               E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */,
                                51A8A6171627F5BB000D90E9 /* NetworkProcess.messages.in */,
                                51FD18B31651FBAD00DBE1CE /* NetworkResourceLoader.cpp */,
                                51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */,
                                512E352A130B559900ABD19A /* ApplicationCache */,
                                3309344B1315B93A0097A7BC /* Cookies */,
                                BCACC43B16B24C5D00B6E092 /* EntryPoint */,
+                               E170876D16D6CA7200F99226 /* FileAPI */,
                                CD73BA3D131A2A2100EEDED2 /* FullScreen */,
                                BC0E5FCB12D696DD0012A72A /* Geolocation */,
                                51FBB9C1132E079200F327B4 /* IconDatabase */,
                        path = SharedWorkerProcess;
                        sourceTree = "<group>";
                };
+               E170876D16D6CA7200F99226 /* FileAPI */ = {
+                       isa = PBXGroup;
+                       children = (
+                               E170876916D6CA6900F99226 /* BlobRegistryProxy.cpp */,
+                               E170876A16D6CA6900F99226 /* BlobRegistryProxy.h */,
+                       );
+                       name = FileAPI;
+                       path = ..;
+                       sourceTree = "<group>";
+               };
+               E170877216D6CFEC00F99226 /* FileAPI */ = {
+                       isa = PBXGroup;
+                       children = (
+                               E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */,
+                               E170876F16D6CFE500F99226 /* BlobRegistrationData.h */,
+                       );
+                       name = FileAPI;
+                       sourceTree = "<group>";
+               };
                E199875B142BF9CF00BB2DE7 /* PDF */ = {
                        isa = PBXGroup;
                        children = (
                                BC5D24C216CD706D007D5461 /* WKDOMNodePrivate.h in Headers */,
                                BC5D24C516CD7088007D5461 /* WKDOMRangePrivate.h in Headers */,
                                BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */,
+                               E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */,
+                               E170877116D6CFE500F99226 /* BlobRegistrationData.h in Headers */,
+                               E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BCAF35E816CA253B00D4E9FC /* OfflineStorageProcessCreationParameters.cpp in Sources */,
                                BCAF362516CA29A200D4E9FC /* OfflineStorageProcessMessageReceiver.cpp in Sources */,
                                51A4D5A916CAC4FF000E615E /* StatisticsRequest.cpp in Sources */,
+                               E170876B16D6CA6900F99226 /* BlobRegistryProxy.cpp in Sources */,
+                               E170877016D6CFE500F99226 /* BlobRegistrationData.cpp in Sources */,
+                               E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp
new file mode 100644 (file)
index 0000000..d5f8cf5
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BlobRegistryProxy.h"
+
+#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#include "BlobRegistrationData.h"
+#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkProcessConnection.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebProcess.h"
+#include <WebCore/BlobData.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData)
+{
+    ASSERT(WebProcess::shared().usesNetworkProcess());
+
+    WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, BlobRegistrationData(blobData)), 0);
+}
+
+void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL)
+{
+    ASSERT(WebProcess::shared().usesNetworkProcess());
+
+    WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0);
+}
+
+void BlobRegistryProxy::unregisterBlobURL(const KURL& url)
+{
+    ASSERT(WebProcess::shared().usesNetworkProcess());
+
+    WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::UnregisterBlobURL(url), 0);
+}
+
+}
+
+#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
diff --git a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h
new file mode 100644 (file)
index 0000000..63d0da4
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobRegistryProxy_h
+#define BlobRegistryProxy_h
+
+#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#include <WebCore/BlobRegistry.h>
+
+namespace WebKit {
+
+class BlobRegistryProxy : public WebCore::BlobRegistry {
+public:
+    virtual void registerBlobURL(const WebCore::KURL&, PassOwnPtr<WebCore::BlobData>);
+    virtual void registerBlobURL(const WebCore::KURL&, const WebCore::KURL& srcURL);
+    virtual void unregisterBlobURL(const WebCore::KURL&);
+};
+
+}
+
+#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)
+
+#endif // BlobRegistryProxy_h
index fb8aabe..dc218bd 100644 (file)
@@ -53,6 +53,7 @@
 #include <wtf/Atomics.h>
 
 #if ENABLE(NETWORK_PROCESS)
+#include "BlobRegistryProxy.h"
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcessConnection.h"
 #include "WebResourceLoadScheduler.h"
@@ -247,6 +248,14 @@ void WebPlatformStrategies::loadResourceSynchronously(NetworkingContext* context
     memcpy(data.data(), dataReference.data(), dataReference.size());
 }
 
+#if ENABLE(BLOB)
+BlobRegistry* WebPlatformStrategies::createBlobRegistry()
+{
+    if (!WebProcess::shared().usesNetworkProcess())
+        return LoaderStrategy::createBlobRegistry();
+    return new BlobRegistryProxy;    
+}
+#endif
 #endif
 
 // PluginStrategy
index 3048b11..e353b64 100644 (file)
@@ -74,6 +74,9 @@ private:
 #if ENABLE(NETWORK_PROCESS)
     virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() OVERRIDE;
     virtual void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) OVERRIDE;
+#if ENABLE(BLOB)
+    virtual WebCore::BlobRegistry* createBlobRegistry() OVERRIDE;
+#endif
 #endif
 
     // WebCore::PluginStrategy