[Win][IndexedDB] Fix build errors.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Apr 2016 18:38:20 +0000 (18:38 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Apr 2016 18:38:20 +0000 (18:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156713

Reviewed by Alex Christensen.

Fix compile and link errors when building with IndexedDB enabled.

Source/WebCore:

* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBTransaction.cpp:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* PlatformWin.cmake:
* platform/win/FileSystemWin.cpp:
(WebCore::hardLinkOrCopyFile):

Source/WebKit:

* PlatformWin.cmake:

Source/WebKit/win:

* WebView.cpp:
(WebView::notifyPreferencesChanged):
* storage: Added.
* storage/WebDatabaseProvider.cpp: Added.
(WebDatabaseProvider::indexedDatabaseDirectoryPath):

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCursor.h
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
Source/WebCore/PlatformWin.cmake
Source/WebCore/platform/win/FileSystemWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformWin.cmake
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit/win/storage/WebDatabaseProvider.cpp [new file with mode: 0644]

index 46e709c..3472dbd 100644 (file)
@@ -1,3 +1,20 @@
+2016-04-25  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win][IndexedDB] Fix build errors.
+        https://bugs.webkit.org/show_bug.cgi?id=156713
+
+        Reviewed by Alex Christensen.
+
+        Fix compile and link errors when building with IndexedDB enabled.
+
+        * Modules/indexeddb/IDBCursor.h:
+        * Modules/indexeddb/IDBTransaction.cpp:
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+        * PlatformWin.cmake:
+        * platform/win/FileSystemWin.cpp:
+        (WebCore::hardLinkOrCopyFile):
+
 2016-04-25  Brady Eidson  <beidson@apple.com>
 
         Implement latest File object spec (including its constructor).
index cc10d98..3c39d9b 100644 (file)
@@ -28,6 +28,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "ActiveDOMObject.h"
+#include "DOMWrapperWorld.h"
 #include "IDBCursorInfo.h"
 #include <heap/Strong.h>
 
index ad57649..f295c74 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "DOMError.h"
+#include "DOMWindow.h"
 #include "Event.h"
 #include "EventQueue.h"
 #include "IDBCursorWithValue.h"
index 21c97b5..9e7712b 100644 (file)
@@ -46,10 +46,10 @@ class MemoryObjectStore;
 typedef HashMap<IDBKeyData, ThreadSafeDataBuffer, IDBKeyDataHash, IDBKeyDataHashTraits> KeyValueMap;
 
 class MemoryBackingStoreTransaction {
-    friend std::unique_ptr<MemoryBackingStoreTransaction> std::make_unique<MemoryBackingStoreTransaction>(WebCore::IDBServer::MemoryIDBBackingStore&, const WebCore::IDBTransactionInfo&);
 public:
     static std::unique_ptr<MemoryBackingStoreTransaction> create(MemoryIDBBackingStore&, const IDBTransactionInfo&);
 
+    MemoryBackingStoreTransaction(MemoryIDBBackingStore&, const IDBTransactionInfo&);
     ~MemoryBackingStoreTransaction();
 
     bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
@@ -74,8 +74,6 @@ public:
     void commit();
 
 private:
-    MemoryBackingStoreTransaction(MemoryIDBBackingStore&, const IDBTransactionInfo&);
-
     void finish();
 
     MemoryIDBBackingStore& m_backingStore;
index adf7ebd..5e79def 100644 (file)
@@ -40,10 +40,10 @@ namespace IDBServer {
 class MemoryObjectStore;
 
 class MemoryIDBBackingStore : public IDBBackingStore {
-    friend std::unique_ptr<MemoryIDBBackingStore> std::make_unique<MemoryIDBBackingStore>(const WebCore::IDBDatabaseIdentifier&);
 public:
     static std::unique_ptr<MemoryIDBBackingStore> create(const IDBDatabaseIdentifier&);
     
+    MemoryIDBBackingStore(const IDBDatabaseIdentifier&);
     ~MemoryIDBBackingStore() final;
 
     IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&) final;
@@ -79,8 +79,6 @@ public:
     void restoreObjectStoreForVersionChangeAbort(Ref<MemoryObjectStore>&&);
 
 private:
-    MemoryIDBBackingStore(const IDBDatabaseIdentifier&);
-
     RefPtr<MemoryObjectStore> takeObjectStoreByIdentifier(uint64_t identifier);
 
     IDBDatabaseIdentifier m_identifier;
index db11cdc..232d519 100644 (file)
@@ -186,7 +186,10 @@ set(WebCore_FORWARDING_HEADERS_DIRECTORIES
 
     Modules/geolocation
     Modules/indexeddb
+
+    Modules/indexeddb/client
     Modules/indexeddb/legacy
+    Modules/indexeddb/server
     Modules/indexeddb/shared
     Modules/notifications
     Modules/webdatabase
index b2dd8de..c2b93e4 100644 (file)
@@ -409,6 +409,11 @@ int readFromFile(PlatformFileHandle handle, char* data, int length)
     return static_cast<int>(bytesRead);
 }
 
+bool hardLinkOrCopyFile(const String& source, const String& destination)
+{
+    return !!::CopyFile(source.charactersWithNullTermination().data(), destination.charactersWithNullTermination().data(), TRUE);
+}
+
 bool unloadModule(PlatformModule module)
 {
     return ::FreeLibrary(module);
index 28fa1e2..1d687e5 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-25  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win][IndexedDB] Fix build errors.
+        https://bugs.webkit.org/show_bug.cgi?id=156713
+
+        Reviewed by Alex Christensen.
+
+        Fix compile and link errors when building with IndexedDB enabled.
+
+        * PlatformWin.cmake:
+
 2016-04-22  Brent Fulgham  <bfulgham@apple.com>
 
         Unreviewed build fix after r199841.
index ca8ee9a..45cc923 100644 (file)
@@ -217,6 +217,8 @@ list(APPEND WebKit_SOURCES_Classes
     win/plugins/PluginView.cpp
     win/plugins/PluginViewWin.cpp
     win/plugins/npapi.cpp
+
+    win/storage/WebDatabaseProvider.cpp
 )
 
 list(APPEND WebKit_SOURCES_WebCoreSupport
index 26fed42..0a4ea0d 100644 (file)
@@ -1,3 +1,18 @@
+2016-04-25  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win][IndexedDB] Fix build errors.
+        https://bugs.webkit.org/show_bug.cgi?id=156713
+
+        Reviewed by Alex Christensen.
+
+        Fix compile and link errors when building with IndexedDB enabled.
+
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+        * storage: Added.
+        * storage/WebDatabaseProvider.cpp: Added.
+        (WebDatabaseProvider::indexedDatabaseDirectoryPath):
+
 2016-04-22  Brent Fulgham  <bfulgham@apple.com>
 
         Unreviewed build fix after 4199841.
index 7cba989..9821bb3 100644 (file)
@@ -5039,6 +5039,10 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         return hr;
     RuntimeEnabledFeatures::sharedFeatures().setCSSRegionsEnabled(!!enabled);
 
+#if ENABLE(INDEXED_DATABASE)
+    RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
+#endif
+
     hr = preferences->privateBrowsingEnabled(&enabled);
     if (FAILED(hr))
         return hr;
diff --git a/Source/WebKit/win/storage/WebDatabaseProvider.cpp b/Source/WebKit/win/storage/WebDatabaseProvider.cpp
new file mode 100644 (file)
index 0000000..5b9ddc0
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 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 "WebDatabaseProvider.h"
+
+#include <shlobj.h>
+#include <shlwapi.h>
+
+#if ENABLE(INDEXED_DATABASE)
+String WebDatabaseProvider::indexedDatabaseDirectoryPath()
+{
+    char executablePath[MAX_PATH];
+    char appDataDirectory[MAX_PATH];
+    char databaseDirectory[MAX_PATH];
+
+    if (FAILED(::SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory))
+        || FAILED(::GetModuleFileNameA(0, executablePath, MAX_PATH)))
+        return emptyString();
+
+    ::PathRemoveExtensionA(executablePath);
+    LPSTR executableName = ::PathFindFileNameA(executablePath);
+    sprintf_s(databaseDirectory, MAX_PATH, "%s\\%s\\WebKit\\Databases\\___IndexedDB", appDataDirectory, executableName);
+
+    if (::SHCreateDirectoryExA(0, databaseDirectory, 0) != ERROR_SUCCESS
+        && ::GetLastError() != ERROR_FILE_EXISTS
+        && ::GetLastError() != ERROR_ALREADY_EXISTS)
+        return emptyString();
+
+    return String(databaseDirectory);
+}
+#endif