Title: [177495] trunk/Source/WebKit2
Revision
177495
Author
[email protected]
Date
2014-12-18 06:41:44 -0800 (Thu, 18 Dec 2014)

Log Message

[GTK] Allow to build with ENABLE_NETWORK_CACHE
https://bugs.webkit.org/show_bug.cgi?id=139728

Reviewed by Antti Koivisto.

Just make it build for now.

* CMakeLists.txt: Add new files to compilation.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Use
ENABLE(SHAREABLE_RESOURCE) when ShareableResource is used.
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::decodeStorageEntry): Ditto.
(WebKit::makeCacheKey): Use ENABLE(CACHE_PARTITIONING) for ResourceRequest::cachePartition().
* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStorage.h:
(WebKit::NetworkCacheStorage::Data::isNull): Move implementation
to platform specific files.
* NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
(WebKit::NetworkCacheStorage::Data::isNull): Moved from the header.
* NetworkProcess/cache/NetworkCacheStorageSoup.cpp: Added.
(WebKit::NetworkCacheStorage::Data::Data):
(WebKit::NetworkCacheStorage::Data::data):
(WebKit::NetworkCacheStorage::Data::isNull):
(WebKit::NetworkCacheStorage::open):
(WebKit::NetworkCacheStorage::NetworkCacheStorage):
(WebKit::NetworkCacheStorage::initializeKeyFilter):
(WebKit::NetworkCacheStorage::removeEntry):
(WebKit::NetworkCacheStorage::dispatchRetrieveOperation):
(WebKit::NetworkCacheStorage::dispatchPendingRetrieveOperations):
(WebKit::NetworkCacheStorage::retrieve):
(WebKit::NetworkCacheStorage::store):
(WebKit::NetworkCacheStorage::setMaximumSize):
(WebKit::NetworkCacheStorage::clear):
* PlatformGTK.cmake: Add NetworkCacheStorageSoup.cpp.
* config.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/CMakeLists.txt (177494 => 177495)


--- trunk/Source/WebKit2/CMakeLists.txt	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/CMakeLists.txt	2014-12-18 14:41:44 UTC (rev 177495)
@@ -157,6 +157,12 @@
 
     NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
 
+    NetworkProcess/cache/NetworkCache.cpp
+    NetworkProcess/cache/NetworkCacheCoders.cpp
+    NetworkProcess/cache/NetworkCacheEncoder.cpp
+    NetworkProcess/cache/NetworkCacheDecoder.cpp
+    NetworkProcess/cache/NetworkCacheKey.cpp
+
     Platform/Logging.cpp
     Platform/Module.cpp
     Platform/WorkQueue.cpp

Modified: trunk/Source/WebKit2/ChangeLog (177494 => 177495)


--- trunk/Source/WebKit2/ChangeLog	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-18 14:41:44 UTC (rev 177495)
@@ -1,3 +1,42 @@
+2014-12-18  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Allow to build with ENABLE_NETWORK_CACHE
+        https://bugs.webkit.org/show_bug.cgi?id=139728
+
+        Reviewed by Antti Koivisto.
+
+        Just make it build for now.
+
+        * CMakeLists.txt: Add new files to compilation.
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Use
+        ENABLE(SHAREABLE_RESOURCE) when ShareableResource is used.
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::decodeStorageEntry): Ditto.
+        (WebKit::makeCacheKey): Use ENABLE(CACHE_PARTITIONING) for ResourceRequest::cachePartition().
+        * NetworkProcess/cache/NetworkCache.h:
+        * NetworkProcess/cache/NetworkCacheStorage.h:
+        (WebKit::NetworkCacheStorage::Data::isNull): Move implementation
+        to platform specific files.
+        * NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
+        (WebKit::NetworkCacheStorage::Data::isNull): Moved from the header.
+        * NetworkProcess/cache/NetworkCacheStorageSoup.cpp: Added.
+        (WebKit::NetworkCacheStorage::Data::Data):
+        (WebKit::NetworkCacheStorage::Data::data):
+        (WebKit::NetworkCacheStorage::Data::isNull):
+        (WebKit::NetworkCacheStorage::open):
+        (WebKit::NetworkCacheStorage::NetworkCacheStorage):
+        (WebKit::NetworkCacheStorage::initializeKeyFilter):
+        (WebKit::NetworkCacheStorage::removeEntry):
+        (WebKit::NetworkCacheStorage::dispatchRetrieveOperation):
+        (WebKit::NetworkCacheStorage::dispatchPendingRetrieveOperations):
+        (WebKit::NetworkCacheStorage::retrieve):
+        (WebKit::NetworkCacheStorage::store):
+        (WebKit::NetworkCacheStorage::setMaximumSize):
+        (WebKit::NetworkCacheStorage::clear):
+        * PlatformGTK.cmake: Add NetworkCacheStorageSoup.cpp.
+        * config.h:
+
 2014-12-17  Dan Bernstein  <[email protected]>
 
         <rdar://problem/19282508> WebKitLegacy is unusable due to bad dylib identifier

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (177494 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2014-12-18 14:41:44 UTC (rev 177495)
@@ -545,14 +545,18 @@
     } else {
         sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry->response, m_parameters.isMainResource));
 
+#if ENABLE(SHAREABLE_RESOURCE)
         if (!entry->shareableResourceHandle.isNull())
             send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle, currentTime()));
         else {
+#endif
             bool shouldContinue = sendBufferMaybeAborting(*entry->buffer, entry->buffer->size());
             if (!shouldContinue)
                 return;
             send(Messages::WebResourceLoader::DidFinishResourceLoad(currentTime()));
+#if ENABLE(SHAREABLE_RESOURCE)
         }
+#endif
     }
 
     cleanup();

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (177494 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2014-12-18 14:41:44 UTC (rev 177495)
@@ -176,12 +176,14 @@
     cachedResponse.setSource(needsRevalidation ? WebCore::ResourceResponse::Source::DiskCacheAfterValidation : WebCore::ResourceResponse::Source::DiskCache);
     entry->response = cachedResponse;
 
+#if ENABLE(SHAREABLE_RESOURCE)
     RefPtr<SharedMemory> sharedMemory = storageEntry.body.size() ? SharedMemory::createFromVMBuffer(const_cast<uint8_t*>(storageEntry.body.data()), storageEntry.body.size()) : nullptr;
     RefPtr<ShareableResource> shareableResource = sharedMemory ? ShareableResource::create(sharedMemory.release(), 0, storageEntry.body.size()) : nullptr;
 
     if (shareableResource && shareableResource->createHandle(entry->shareableResourceHandle))
         entry->buffer = entry->shareableResourceHandle.tryWrapInSharedBuffer();
     else
+#endif
         entry->buffer = WebCore::SharedBuffer::create(storageEntry.body.data(), storageEntry.body.size());
 
     return entry;
@@ -205,7 +207,11 @@
 
 static NetworkCacheKey makeCacheKey(const WebCore::ResourceRequest& request)
 {
+#if ENABLE(CACHE_PARTITIONING)
     String partition = request.cachePartition();
+#else
+    String partition;
+#endif
     if (partition.isEmpty())
         partition = ASCIILiteral("No partition");
     return NetworkCacheKey(request.httpMethod(), partition, request.url().string());

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h (177494 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h	2014-12-18 14:41:44 UTC (rev 177495)
@@ -30,7 +30,7 @@
 
 #include "NetworkCacheStorage.h"
 #include "ShareableResource.h"
-#include <Webcore/ResourceResponse.h>
+#include <WebCore/ResourceResponse.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -56,7 +56,9 @@
     struct Entry {
         WebCore::ResourceResponse response;
         RefPtr<WebCore::SharedBuffer> buffer;
+#if ENABLE(SHAREABLE_RESOURCE)
         ShareableResource::Handle shareableResourceHandle;
+#endif
         bool needsRevalidation;
     };
     // Completion handler may get called back synchronously on failure.

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h (177494 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h	2014-12-18 14:41:44 UTC (rev 177495)
@@ -63,7 +63,7 @@
 #if PLATFORM(COCOA)
         explicit Data(OSObjectPtr<dispatch_data_t>);
 #endif
-        bool isNull() const { return !m_dispatchData; }
+        bool isNull() const;
 
         const uint8_t* data() const;
         size_t size() const { return m_size; }

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm (177494 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm	2014-12-18 14:41:44 UTC (rev 177495)
@@ -105,6 +105,11 @@
     return m_data;
 }
 
+bool NetworkCacheStorage::Data::isNull() const
+{
+    return !m_dispatchData;
+}
+
 std::unique_ptr<NetworkCacheStorage> NetworkCacheStorage::open(const String& cachePath)
 {
     ASSERT(RunLoop::isMain());

Added: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageSoup.cpp (0 => 177495)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageSoup.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageSoup.cpp	2014-12-18 14:41:44 UTC (rev 177495)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "NetworkCacheStorage.h"
+
+#if ENABLE(NETWORK_CACHE)
+
+#include "Logging.h"
+#include "NetworkCacheCoders.h"
+#include <WebCore/FileSystem.h>
+#include <WebCore/NotImplemented.h>
+#include <wtf/RunLoop.h>
+
+namespace WebKit {
+
+static const char* networkCacheSubdirectory = "WebKitCache";
+
+NetworkCacheStorage::Data::Data()
+    : m_data(nullptr)
+    , m_size(0)
+{
+    notImplemented();
+}
+
+NetworkCacheStorage::Data::Data(const uint8_t* data, size_t size)
+    : m_data(data)
+    , m_size(size)
+{
+    notImplemented();
+}
+
+const uint8_t* NetworkCacheStorage::Data::data() const
+{
+    notImplemented();
+    return nullptr;
+}
+
+bool NetworkCacheStorage::Data::isNull() const
+{
+    notImplemented();
+    return true;
+}
+
+std::unique_ptr<NetworkCacheStorage> NetworkCacheStorage::open(const String& applicationCachePath)
+{
+    ASSERT(RunLoop::isMain());
+    String networkCachePath = WebCore::pathByAppendingComponent(applicationCachePath, networkCacheSubdirectory);
+    if (!WebCore::makeAllDirectories(networkCachePath))
+        return nullptr;
+    return std::unique_ptr<NetworkCacheStorage>(new NetworkCacheStorage(networkCachePath));
+}
+
+NetworkCacheStorage::NetworkCacheStorage(const String& directoryPath)
+    : m_directoryPath(directoryPath)
+    , m_maximumSize(std::numeric_limits<size_t>::max())
+    , m_activeRetrieveOperationCount(0)
+{
+    initializeKeyFilter();
+}
+
+void NetworkCacheStorage::initializeKeyFilter()
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+}
+
+void NetworkCacheStorage::removeEntry(const NetworkCacheKey&)
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+}
+
+void NetworkCacheStorage::dispatchRetrieveOperation(const RetrieveOperation&)
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+}
+
+void NetworkCacheStorage::dispatchPendingRetrieveOperations()
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+}
+
+void NetworkCacheStorage::retrieve(const NetworkCacheKey&, unsigned /* priority */, std::function<bool (std::unique_ptr<Entry>)> completionHandler)
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+    completionHandler(nullptr);
+}
+
+void NetworkCacheStorage::store(const NetworkCacheKey&, const Entry&, std::function<void (bool success)> completionHandler)
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+    completionHandler(false);
+}
+
+void NetworkCacheStorage::setMaximumSize(size_t size)
+{
+    ASSERT(RunLoop::isMain());
+    notImplemented();
+    m_maximumSize = size;
+}
+
+void NetworkCacheStorage::clear()
+{
+    ASSERT(RunLoop::isMain());
+    LOG(NetworkCacheStorage, "(NetworkProcess) clearing cache");
+    notImplemented();
+    m_keyFilter.clear();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_CACHE)

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (177494 => 177495)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2014-12-18 14:41:44 UTC (rev 177495)
@@ -15,6 +15,8 @@
 set(WebKit2_USE_PREFIX_HEADER ON)
 
 list(APPEND WebKit2_SOURCES
+    NetworkProcess/cache/NetworkCacheStorageSoup.cpp
+
     NetworkProcess/gtk/NetworkProcessMainGtk.cpp
 
     NetworkProcess/soup/NetworkProcessSoup.cpp

Modified: trunk/Source/WebKit2/config.h (177494 => 177495)


--- trunk/Source/WebKit2/config.h	2014-12-18 13:41:59 UTC (rev 177494)
+++ trunk/Source/WebKit2/config.h	2014-12-18 14:41:44 UTC (rev 177495)
@@ -94,7 +94,7 @@
 #endif
 
 #ifndef ENABLE_NETWORK_CACHE
-#if PLATFORM(MAC) && ENABLE(NETWORK_PROCESS)
+#if (PLATFORM(MAC) || PLATFORM(GTK)) && ENABLE(NETWORK_PROCESS)
 #define ENABLE_NETWORK_CACHE 0
 #endif
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to