Skip to content
Permalink
Browse files
[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.

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):


Canonical link: https://commits.webkit.org/175092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
peavo committed Apr 25, 2016
1 parent b1ea864 commit 606c0edb6962e58327475e344945a2265ad79e51
@@ -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).
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)

#include "ActiveDOMObject.h"
#include "DOMWrapperWorld.h"
#include "IDBCursorInfo.h"
#include <heap/Strong.h>

@@ -29,6 +29,7 @@
#if ENABLE(INDEXED_DATABASE)

#include "DOMError.h"
#include "DOMWindow.h"
#include "Event.h"
#include "EventQueue.h"
#include "IDBCursorWithValue.h"
@@ -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 @@ class MemoryBackingStoreTransaction {
void commit();

private:
MemoryBackingStoreTransaction(MemoryIDBBackingStore&, const IDBTransactionInfo&);

void finish();

MemoryIDBBackingStore& m_backingStore;
@@ -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 @@ class MemoryIDBBackingStore : public IDBBackingStore {
void restoreObjectStoreForVersionChangeAbort(Ref<MemoryObjectStore>&&);

private:
MemoryIDBBackingStore(const IDBDatabaseIdentifier&);

RefPtr<MemoryObjectStore> takeObjectStoreByIdentifier(uint64_t identifier);

IDBDatabaseIdentifier m_identifier;
@@ -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
@@ -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);
@@ -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.
@@ -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
@@ -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.
@@ -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;
@@ -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

0 comments on commit 606c0ed

Please sign in to comment.