Title: [195090] trunk/Source
Revision
195090
Author
[email protected]
Date
2016-01-14 21:40:39 -0800 (Thu, 14 Jan 2016)

Log Message

Modern IDB: Support opening and deleting SQLite databases on disk.
https://bugs.webkit.org/show_bug.cgi?id=153084

Reviewed by Alex Christensen, Sam Weinig and Andy Estes (oh my!).

Source/WebCore:

No new tests (Infrastructure, no testable change in behavior).

* Modules/indexeddb/IDBDatabaseIdentifier.cpp:
(WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
* Modules/indexeddb/IDBDatabaseIdentifier.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::create):
(WebCore::IDBServer::IDBServer::IDBServer):
(WebCore::IDBServer::IDBServer::createBackingStore):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::create):
(WebCore::InProcessIDBServer::InProcessIDBServer):
* Modules/indexeddb/shared/InProcessIDBServer.h:

Source/WebKit:

* Storage/WebDatabaseProvider.cpp:
(WebDatabaseProvider::idbConnectionToServerForSession):
* Storage/WebDatabaseProvider.h:

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

* Storage/WebDatabaseProvider.mm: Copied from Source/WebKit/Storage/WebDatabaseProvider.cpp.
(WebDatabaseProvider::indexedDatabaseDirectoryPath):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195089 => 195090)


--- trunk/Source/WebCore/ChangeLog	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/ChangeLog	2016-01-15 05:40:39 UTC (rev 195090)
@@ -1,3 +1,33 @@
+2016-01-14  Brady Eidson  <[email protected]>
+
+        Modern IDB: Support opening and deleting SQLite databases on disk.
+        https://bugs.webkit.org/show_bug.cgi?id=153084
+
+        Reviewed by Alex Christensen, Sam Weinig and Andy Estes (oh my!).
+
+        No new tests (Infrastructure, no testable change in behavior).
+
+        * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
+        (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
+        * Modules/indexeddb/IDBDatabaseIdentifier.h:
+
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::create):
+        (WebCore::IDBServer::IDBServer::IDBServer):
+        (WebCore::IDBServer::IDBServer::createBackingStore):
+        * Modules/indexeddb/server/IDBServer.h:
+
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+        (WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
+        (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
+        (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
+
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::create):
+        (WebCore::InProcessIDBServer::InProcessIDBServer):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
 2016-01-14  Myles C. Maxfield  <[email protected]>
 
         Mixing Content Blocking of fonts and display:none rules causes battery drain

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp	2016-01-15 05:40:39 UTC (rev 195090)
@@ -28,6 +28,8 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "FileSystem.h"
+#include "SecurityOrigin.h"
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -55,6 +57,17 @@
     return identifier;
 }
 
+String IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(const String& rootDirectory) const
+{
+    String mainFrameDirectory = pathByAppendingComponent(rootDirectory, m_mainFrameOrigin.securityOrigin()->databaseIdentifier());
+
+    // If the opening origin and main frame origins are the same, there is no partitioning.
+    if (m_openingOrigin == m_mainFrameOrigin)
+        return mainFrameDirectory;
+
+    return pathByAppendingComponent(mainFrameDirectory, m_openingOrigin.securityOrigin()->databaseIdentifier());
+}
+
 #ifndef NDEBUG
 String IDBDatabaseIdentifier::debugString() const
 {

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h	2016-01-15 05:40:39 UTC (rev 195090)
@@ -92,6 +92,8 @@
 
     const String& databaseName() const { return m_databaseName; }
 
+    String databaseDirectoryRelativeToRoot(const String& rootDirectory) const;
+
 #ifndef NDEBUG
     String debugString() const;
 #endif

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2016-01-15 05:40:39 UTC (rev 195090)
@@ -32,6 +32,7 @@
 #include "IDBResultData.h"
 #include "Logging.h"
 #include "MemoryIDBBackingStore.h"
+#include "SQLiteIDBBackingStore.h"
 #include <wtf/Locker.h>
 #include <wtf/MainThread.h>
 
@@ -43,12 +44,26 @@
     return adoptRef(*new IDBServer());
 }
 
+Ref<IDBServer> IDBServer::create(const String& databaseDirectoryPath)
+{
+    return adoptRef(*new IDBServer(databaseDirectoryPath));
+}
+
 IDBServer::IDBServer()
 {
     Locker<Lock> locker(m_databaseThreadCreationLock);
     m_threadID = createThread(IDBServer::databaseThreadEntry, this, "IndexedDatabase Server");
 }
 
+IDBServer::IDBServer(const String& databaseDirectoryPath)
+    : m_databaseDirectoryPath(databaseDirectoryPath)
+{
+    LOG(IndexedDB, "IDBServer created at path %s", databaseDirectoryPath.utf8().data());
+
+    Locker<Lock> locker(m_databaseThreadCreationLock);
+    m_threadID = createThread(IDBServer::databaseThreadEntry, this, "IndexedDatabase Server");
+}
+
 void IDBServer::registerConnection(IDBConnectionToClient& connection)
 {
     ASSERT(!m_connectionMap.contains(connection.identifier()));
@@ -102,9 +117,7 @@
 {
     ASSERT(!isMainThread());
 
-    // FIXME: For now we only have the in-memory backing store, which we'll continue to use for private browsing.
-    // Once it's time for persistent backing stores this is where we'll calculate the correct path on disk
-    // and create it.
+    // FIXME: Once the SQLite backing store is functional, conditionally make either a Memory or SQLite backing store.
 
     return MemoryIDBBackingStore::create(identifier);
 }

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2016-01-15 05:40:39 UTC (rev 195090)
@@ -51,6 +51,7 @@
 class IDBServer : public RefCounted<IDBServer> {
 public:
     static Ref<IDBServer> create();
+    static Ref<IDBServer> create(const String& databaseDirectoryPath);
 
     void registerConnection(IDBConnectionToClient&);
     void unregisterConnection(IDBConnectionToClient&);
@@ -92,6 +93,7 @@
 
 private:
     IDBServer();
+    IDBServer(const String& databaseDirectoryPath);
 
     UniqueIDBDatabase& getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier&);
 
@@ -112,6 +114,8 @@
 
     HashMap<uint64_t, UniqueIDBDatabaseConnection*> m_databaseConnections;
     HashMap<IDBResourceIdentifier, UniqueIDBDatabaseTransaction*> m_transactions;
+
+    String m_databaseDirectoryPath;
 };
 
 } // namespace IDBServer

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-15 05:40:39 UTC (rev 195090)
@@ -28,26 +28,54 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "FileSystem.h"
 #include "IDBDatabaseException.h"
-#include "NotImplemented.h"
+#include "IDBKeyData.h"
+#include "Logging.h"
+#include "SQLiteDatabase.h"
+#include "SQLiteFileSystem.h"
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 namespace IDBServer {
 
-SQLiteIDBBackingStore::SQLiteIDBBackingStore(const IDBDatabaseIdentifier& identifier)
+SQLiteIDBBackingStore::SQLiteIDBBackingStore(const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory)
     : m_identifier(identifier)
 {
+    m_absoluteDatabaseDirectory = identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory);
 }
 
 SQLiteIDBBackingStore::~SQLiteIDBBackingStore()
 {
+    if (m_sqliteDB)
+        m_sqliteDB->close();
 }
 
 const IDBDatabaseInfo& SQLiteIDBBackingStore::getOrEstablishDatabaseInfo()
 {
-    if (!m_databaseInfo)
-        m_databaseInfo = std::make_unique<IDBDatabaseInfo>(m_identifier.databaseName(), 0);
+    LOG(IndexedDB, "SQLiteIDBBackingStore::getOrEstablishDatabaseInfo - database %s", m_identifier.databaseName().utf8().data());
 
+    if (m_databaseInfo)
+        return *m_databaseInfo;
+
+    m_databaseInfo = std::make_unique<IDBDatabaseInfo>(m_identifier.databaseName(), 0);
+
+    makeAllDirectories(m_absoluteDatabaseDirectory);
+
+    String dbFilename = pathByAppendingComponent(m_absoluteDatabaseDirectory, "IndexedDB.sqlite3");
+
+    m_sqliteDB = std::make_unique<SQLiteDatabase>();
+    if (!m_sqliteDB->open(dbFilename)) {
+        LOG_ERROR("Failed to open SQLite database at path '%s'", dbFilename.utf8().data());
+        m_sqliteDB = nullptr;
+    }
+
+    if (!m_sqliteDB)
+        return *m_databaseInfo;
+
+    // FIXME: Support populating new SQLite files and pulling DatabaseInfo from existing SQLite files.
+    // Doing so will make a new m_databaseInfo which overrides the default one we created up above.
+
     return *m_databaseInfo;
 }
 
@@ -148,7 +176,17 @@
 
 void SQLiteIDBBackingStore::deleteBackingStore()
 {
-    notImplemented();
+    String dbFilename = pathByAppendingComponent(m_absoluteDatabaseDirectory, "IndexedDB.sqlite3");
+
+    LOG(IndexedDB, "SQLiteIDBBackingStore::deleteBackingStore deleting file '%s' on disk", dbFilename.utf8().data());
+
+    if (m_sqliteDB) {
+        m_sqliteDB->close();
+        m_sqliteDB = nullptr;
+    }
+
+    SQLiteFileSystem::deleteDatabaseFile(dbFilename);
+    SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_absoluteDatabaseDirectory);
 }
 
 } // namespace IDBServer

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h	2016-01-15 05:40:39 UTC (rev 195090)
@@ -33,11 +33,14 @@
 #include "IDBDatabaseInfo.h"
 
 namespace WebCore {
+
+class SQLiteDatabase;
+
 namespace IDBServer {
 
 class SQLiteIDBBackingStore : public IDBBackingStore {
 public:
-    SQLiteIDBBackingStore(const IDBDatabaseIdentifier&);
+    SQLiteIDBBackingStore(const IDBDatabaseIdentifier&, const String& databaseRootDirectory);
     
     virtual ~SQLiteIDBBackingStore() override final;
 
@@ -68,6 +71,10 @@
 private:
     IDBDatabaseIdentifier m_identifier;
     std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
+
+    std::unique_ptr<SQLiteDatabase> m_sqliteDB;
+
+    String m_absoluteDatabaseDirectory;
 };
 
 } // namespace IDBServer

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2016-01-15 05:40:39 UTC (rev 195090)
@@ -47,6 +47,13 @@
     return server;
 }
 
+Ref<InProcessIDBServer> InProcessIDBServer::create(const String& databaseDirectoryPath)
+{
+    Ref<InProcessIDBServer> server = adoptRef(*new InProcessIDBServer(databaseDirectoryPath));
+    server->m_server->registerConnection(server->connectionToClient());
+    return server;
+}
+
 InProcessIDBServer::InProcessIDBServer()
     : m_server(IDBServer::IDBServer::create())
 {
@@ -55,6 +62,14 @@
     m_connectionToClient = IDBServer::IDBConnectionToClient::create(*this);
 }
 
+InProcessIDBServer::InProcessIDBServer(const String& databaseDirectoryPath)
+    : m_server(IDBServer::IDBServer::create(databaseDirectoryPath))
+{
+    relaxAdoptionRequirement();
+    m_connectionToServer = IDBClient::IDBConnectionToServer::create(*this);
+    m_connectionToClient = IDBServer::IDBConnectionToClient::create(*this);
+}
+
 uint64_t InProcessIDBServer::identifier() const
 {
     // An instance of InProcessIDBServer always has a 1:1 relationship with its instance of IDBServer.

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (195089 => 195090)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2016-01-15 05:40:39 UTC (rev 195090)
@@ -49,6 +49,7 @@
 class InProcessIDBServer final : public IDBClient::IDBConnectionToServerDelegate, public IDBServer::IDBConnectionToClientDelegate, public RefCounted<InProcessIDBServer> {
 public:
     WEBCORE_EXPORT static Ref<InProcessIDBServer> create();
+    WEBCORE_EXPORT static Ref<InProcessIDBServer> create(const String& databaseDirectoryPath);
 
     WEBCORE_EXPORT IDBClient::IDBConnectionToServer& connectionToServer() const;
     IDBServer::IDBConnectionToClient& connectionToClient() const;
@@ -101,6 +102,7 @@
 
 private:
     InProcessIDBServer();
+    InProcessIDBServer(const String& databaseDirectoryPath);
 
     Ref<IDBServer::IDBServer> m_server;
     RefPtr<IDBClient::IDBConnectionToServer> m_connectionToServer;

Modified: trunk/Source/WebKit/ChangeLog (195089 => 195090)


--- trunk/Source/WebKit/ChangeLog	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebKit/ChangeLog	2016-01-15 05:40:39 UTC (rev 195090)
@@ -1,3 +1,16 @@
+2016-01-14  Brady Eidson  <[email protected]>
+
+        Modern IDB: Support opening and deleting SQLite databases on disk.
+        https://bugs.webkit.org/show_bug.cgi?id=153084
+
+        Reviewed by Alex Christensen, Sam Weinig and Andy Estes (oh my!).
+
+        * Storage/WebDatabaseProvider.cpp:
+        (WebDatabaseProvider::idbConnectionToServerForSession):
+        * Storage/WebDatabaseProvider.h:
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2016-01-13  Chris Dumez  <[email protected]>
 
         Unreviewed, rolling out r194900.

Modified: trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp (195089 => 195090)


--- trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp	2016-01-15 05:40:39 UTC (rev 195090)
@@ -53,8 +53,12 @@
 WebCore::IDBClient::IDBConnectionToServer& WebDatabaseProvider::idbConnectionToServerForSession(const WebCore::SessionID& sessionID)
 {
     auto result = m_idbServerMap.add(sessionID.sessionID(), nullptr);
-    if (result.isNewEntry)
-        result.iterator->value = WebCore::InProcessIDBServer::create();
+    if (result.isNewEntry) {
+        if (sessionID.isEphemeral())
+            result.iterator->value = WebCore::InProcessIDBServer::create();
+        else
+            result.iterator->value = WebCore::InProcessIDBServer::create(indexedDatabaseDirectoryPath());
+    }
 
     return result.iterator->value->connectionToServer();
 }

Modified: trunk/Source/WebKit/Storage/WebDatabaseProvider.h (195089 => 195090)


--- trunk/Source/WebKit/Storage/WebDatabaseProvider.h	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebKit/Storage/WebDatabaseProvider.h	2016-01-15 05:40:39 UTC (rev 195090)
@@ -49,6 +49,8 @@
 private:
     explicit WebDatabaseProvider();
 
+    static String indexedDatabaseDirectoryPath();
+
 #if ENABLE(INDEXED_DATABASE)
     virtual RefPtr<WebCore::IDBFactoryBackendInterface> createIDBFactoryBackend() override;
     HashMap<uint64_t, RefPtr<WebCore::InProcessIDBServer>> m_idbServerMap;

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (195089 => 195090)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2016-01-15 05:40:39 UTC (rev 195090)
@@ -127,6 +127,7 @@
 		511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */; };
 		511F3FD80CECC88F00852565 /* WebDatabaseManagerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */; };
+		512BDB531C471591006494DF /* WebDatabaseProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512BDB521C471591006494DF /* WebDatabaseProvider.mm */; };
 		51494CD60C7EBDE0004178C5 /* WebIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494CD40C7EBDE0004178C5 /* WebIconDatabaseClient.h */; };
 		51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */; };
 		5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; };
@@ -606,6 +607,7 @@
 		511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; };
 		511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerClient.h; sourceTree = "<group>"; };
 		511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManagerClient.mm; sourceTree = "<group>"; };
+		512BDB521C471591006494DF /* WebDatabaseProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseProvider.mm; sourceTree = "<group>"; };
 		513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPolicyDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPolicyDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -1223,6 +1225,7 @@
 				511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
 				1AA83F811A5C4AE400026EC6 /* WebDatabaseProvider.cpp */,
 				1AA83F821A5C4AE400026EC6 /* WebDatabaseProvider.h */,
+				512BDB521C471591006494DF /* WebDatabaseProvider.mm */,
 				A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
 				A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
 				3AB02AF512C1319B00FBB694 /* WebStorageManager.mm */,
@@ -2295,6 +2298,7 @@
 				939810C70824BF01008DF038 /* WebNSImageExtras.m in Sources */,
 				934C4A910F01406C009372C0 /* WebNSObjectExtras.mm in Sources */,
 				939810C80824BF01008DF038 /* WebNSPasteboardExtras.mm in Sources */,
+				512BDB531C471591006494DF /* WebDatabaseProvider.mm in Sources */,
 				939811190824BF01008DF038 /* WebNSPrintOperationExtras.m in Sources */,
 				A10C1D3B18202FC50036883A /* WebNSStringExtrasIOS.m in Sources */,
 				939811120824BF01008DF038 /* WebNSURLExtras.mm in Sources */,

Modified: trunk/Source/WebKit/mac/ChangeLog (195089 => 195090)


--- trunk/Source/WebKit/mac/ChangeLog	2016-01-15 05:23:21 UTC (rev 195089)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-01-15 05:40:39 UTC (rev 195090)
@@ -1,3 +1,13 @@
+2016-01-14  Brady Eidson  <[email protected]>
+
+        Modern IDB: Support opening and deleting SQLite databases on disk.
+        https://bugs.webkit.org/show_bug.cgi?id=153084
+
+        Reviewed by Alex Christensen, Sam Weinig and Andy Estes (oh my!).
+
+        * Storage/WebDatabaseProvider.mm: Copied from Source/WebKit/Storage/WebDatabaseProvider.cpp.
+        (WebDatabaseProvider::indexedDatabaseDirectoryPath):
+
 2016-01-14  Beth Dakin  <[email protected]>
 
         WK1 and WK2 should share more candidate request code

Copied: trunk/Source/WebKit/mac/Storage/WebDatabaseProvider.mm (from rev 195089, trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp) (0 => 195090)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseProvider.mm	                        (rev 0)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseProvider.mm	2016-01-15 05:40:39 UTC (rev 195090)
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#import "WebDatabaseProvider.h"
+#import "WebDatabaseManagerPrivate.h"
+
+#import <WebCore/FileSystem.h>
+
+String WebDatabaseProvider::indexedDatabaseDirectoryPath()
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey];
+    if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
+        databasesDirectory = WebCore::pathByAppendingComponent(ASCIILiteral("~/Library/WebKit/Databases/___IndexedDB"), [[NSBundle mainBundle] bundleIdentifier]);
+    else
+        databasesDirectory = WebCore::pathByAppendingComponent(databasesDirectory, ASCIILiteral("___IndexedDB"));
+    
+    return [databasesDirectory stringByStandardizingPath];
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to