Refactor IDB factory creation.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 04:19:39 +0000 (04:19 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 04:19:39 +0000 (04:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123347

Reviewed by Andreas Kling.

- Rework how database directory location is passed around.
- Make (some) SecurityOrigin arguments be references instead of pointers.
- Add two SecurityOrigin arguments to opening databases for future use.

Source/WebCore:

* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::openInternal):

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

* Modules/indexeddb/PageGroupIndexedDatabase.cpp:
(WebCore::PageGroupIndexedDatabase::PageGroupIndexedDatabase):
(WebCore::PageGroupIndexedDatabase::from):
(WebCore::PageGroupIndexedDatabase::factoryBackend):
* Modules/indexeddb/PageGroupIndexedDatabase.h:

* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
(WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
(WebCore::WorkerGlobalScopeIndexedDatabase::from):
(WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:

* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
(WebCore::IDBBackingStoreLevelDB::open):
(WebCore::IDBBackingStoreLevelDB::openInMemory):
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:

* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
(WebCore::computeFileIdentifier):
(WebCore::computeUniqueIdentifier):
(WebCore::IDBFactoryBackendLevelDB::IDBFactoryBackendLevelDB):
(WebCore::IDBFactoryBackendLevelDB::getDatabaseNames):
(WebCore::IDBFactoryBackendLevelDB::deleteDatabase):
(WebCore::IDBFactoryBackendLevelDB::openBackingStore):
(WebCore::IDBFactoryBackendLevelDB::open):
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
(WebCore::IDBFactoryBackendLevelDB::create):

* WebCore.exp.in:

* platform/DatabaseStrategy.cpp:
(WebCore::DatabaseStrategy::createIDBFactoryBackend):
* platform/DatabaseStrategy.h:

Source/WebKit2:

* Shared/Databases/IndexedDB/IDBUtilities.cpp:
(WebKit::uniqueDatabaseIdentifier):
* Shared/Databases/IndexedDB/IDBUtilities.h:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::WebIDBFactoryBackend::WebIDBFactoryBackend):
(WebKit::WebIDBFactoryBackend::open):
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
(WebKit::WebIDBFactoryBackend::create):

* WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.cpp:
(WebKit::WebProcessIDBDatabaseBackend::WebProcessIDBDatabaseBackend):
* WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.h:

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::createIDBFactoryBackend):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

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

24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBFactory.cpp
Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.cpp
Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h
Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h
Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/DatabaseStrategy.cpp
Source/WebCore/platform/DatabaseStrategy.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Databases/IndexedDB/IDBUtilities.cpp
Source/WebKit2/Shared/Databases/IndexedDB/IDBUtilities.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.h
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

index 7bf7925..c98790d 100644 (file)
@@ -1,3 +1,55 @@
+2013-10-28  Brady Eidson  <beidson@apple.com>
+
+        Refactor IDB factory creation.
+        https://bugs.webkit.org/show_bug.cgi?id=123347
+
+        Reviewed by Andreas Kling.
+
+        - Rework how database directory location is passed around.
+        - Make (some) SecurityOrigin arguments be references instead of pointers.
+        - Add two SecurityOrigin arguments to opening databases for future use.
+
+        * Modules/indexeddb/IDBFactory.cpp:
+        (WebCore::IDBFactory::openInternal):
+
+        * Modules/indexeddb/IDBFactoryBackendInterface.cpp:
+        (WebCore::IDBFactoryBackendInterface::create):
+        * Modules/indexeddb/IDBFactoryBackendInterface.h:
+
+        * Modules/indexeddb/PageGroupIndexedDatabase.cpp:
+        (WebCore::PageGroupIndexedDatabase::PageGroupIndexedDatabase):
+        (WebCore::PageGroupIndexedDatabase::from):
+        (WebCore::PageGroupIndexedDatabase::factoryBackend):
+        * Modules/indexeddb/PageGroupIndexedDatabase.h:
+
+        * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
+        (WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
+        (WebCore::WorkerGlobalScopeIndexedDatabase::from):
+        (WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
+        * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
+
+        * Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
+        (WebCore::IDBBackingStoreLevelDB::open):
+        (WebCore::IDBBackingStoreLevelDB::openInMemory):
+        * Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
+        (WebCore::computeFileIdentifier):
+        (WebCore::computeUniqueIdentifier):
+        (WebCore::IDBFactoryBackendLevelDB::IDBFactoryBackendLevelDB):
+        (WebCore::IDBFactoryBackendLevelDB::getDatabaseNames):
+        (WebCore::IDBFactoryBackendLevelDB::deleteDatabase):
+        (WebCore::IDBFactoryBackendLevelDB::openBackingStore):
+        (WebCore::IDBFactoryBackendLevelDB::open):
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
+        (WebCore::IDBFactoryBackendLevelDB::create):
+
+        * WebCore.exp.in:
+
+        * platform/DatabaseStrategy.cpp:
+        (WebCore::DatabaseStrategy::createIDBFactoryBackend):
+        * platform/DatabaseStrategy.h:
+
 2013-10-28  Andreas Kling  <akling@apple.com>
 
         RenderElement::style() should return a reference.
index 61a093a..e7dfead 100644 (file)
@@ -147,7 +147,7 @@ PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext* co
     RefPtr<IDBDatabaseCallbacks> databaseCallbacks = IDBDatabaseCallbacksImpl::create();
     int64_t transactionId = IDBDatabase::nextTransactionId();
     RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(context, databaseCallbacks, transactionId, version, versionNullness);
-    m_backend->open(name, version, transactionId, request, databaseCallbacks, context->securityOrigin(), context, getIndexedDBDatabasePath(context));
+    m_backend->open(name, version, transactionId, request, databaseCallbacks, *(context->securityOrigin()), *(context->topOrigin()));
     return request;
 }
 
index 03c445b..d1c9fbd 100644 (file)
@@ -35,9 +35,9 @@
 
 namespace WebCore {
 
-PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create()
+PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create(const String& databaseDirectoryIdentifier)
 {
-    return platformStrategies()->databaseStrategy()->createIDBFactoryBackend();
+    return platformStrategies()->databaseStrategy()->createIDBFactoryBackend(databaseDirectoryIdentifier);
 }
 
 } // namespace WebCore
index 2f013d3..9346663 100644 (file)
@@ -55,11 +55,11 @@ typedef int ExceptionCode;
 // trigger work on a background thread if necessary.
 class IDBFactoryBackendInterface : public RefCounted<IDBFactoryBackendInterface> {
 public:
-    static PassRefPtr<IDBFactoryBackendInterface> create();
+    static PassRefPtr<IDBFactoryBackendInterface> create(const String& databaseDirectoryIdentifier);
     virtual ~IDBFactoryBackendInterface() { }
 
     virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
-    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
+    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin) = 0;
     virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
 
     virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) = 0;
index 840ef08..a7cbcd7 100644 (file)
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "GroupSettings.h"
 #include "IDBFactoryBackendInterface.h"
 #include "PageGroup.h"
 
 namespace WebCore {
 
-PageGroupIndexedDatabase::PageGroupIndexedDatabase()
+PageGroupIndexedDatabase::PageGroupIndexedDatabase(const String& databaseDirectoryIdentifier)
+    : m_databaseDirectoryIdentifier(databaseDirectoryIdentifier)
 {
 }
 
@@ -50,7 +52,7 @@ PageGroupIndexedDatabase* PageGroupIndexedDatabase::from(PageGroup& group)
 {
     PageGroupIndexedDatabase* supplement = static_cast<PageGroupIndexedDatabase*>(Supplement<PageGroup>::from(&group, supplementName()));
     if (!supplement) {
-        supplement = new PageGroupIndexedDatabase();
+        supplement = new PageGroupIndexedDatabase(group.groupSettings().indexedDBDatabasePath());
         provideTo(&group, supplementName(), adoptPtr(supplement));
     }
     return supplement;
@@ -61,7 +63,7 @@ IDBFactoryBackendInterface* PageGroupIndexedDatabase::factoryBackend()
     // Do not add page setting based access control here since this object is shared by all pages in
     // the group and having per-page controls is misleading.
     if (!m_factoryBackend)
-        m_factoryBackend = IDBFactoryBackendInterface::create();
+        m_factoryBackend = IDBFactoryBackendInterface::create(m_databaseDirectoryIdentifier);
     return m_factoryBackend.get();
 }
 
index ff78a65..92a2558 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "Supplementable.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -43,9 +44,10 @@ public:
     IDBFactoryBackendInterface* factoryBackend();
 
 private:
-    PageGroupIndexedDatabase();
+    explicit PageGroupIndexedDatabase(const String& databaseDirectoryIdentifier);
     static const char* supplementName();
 
+    String m_databaseDirectoryIdentifier;
     RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
 };
 
index f9777ad..27eb5e1 100644 (file)
@@ -38,7 +38,8 @@
 
 namespace WebCore {
 
-WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase()
+WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase(const String& databaseDirectoryIdentifier)
+    : m_databaseDirectoryIdentifier(databaseDirectoryIdentifier)
 {
 }
 
@@ -55,7 +56,13 @@ WorkerGlobalScopeIndexedDatabase* WorkerGlobalScopeIndexedDatabase::from(ScriptE
 {
     WorkerGlobalScopeIndexedDatabase* supplement = static_cast<WorkerGlobalScopeIndexedDatabase*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
     if (!supplement) {
-        supplement = new WorkerGlobalScopeIndexedDatabase();
+        String databaseDirectoryIdentifier;
+        WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
+        const GroupSettings* groupSettings = workerGlobalScope->groupSettings();
+        if (groupSettings)
+            databaseDirectoryIdentifier = groupSettings->indexedDBDatabasePath();
+
+        supplement = new WorkerGlobalScopeIndexedDatabase(databaseDirectoryIdentifier);
         provideTo(context, supplementName(), adoptPtr(supplement));
     }
     return supplement;
@@ -69,7 +76,7 @@ IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB(ScriptExecutionContext*
 IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB()
 {
     if (!m_factoryBackend)
-        m_factoryBackend = IDBFactoryBackendInterface::create();
+        m_factoryBackend = IDBFactoryBackendInterface::create(m_databaseDirectoryIdentifier);
     if (!m_idbFactory)
         m_idbFactory = IDBFactory::create(m_factoryBackend.get());
     return m_idbFactory.get();
index 49e038e..3f689ee 100644 (file)
@@ -30,6 +30,7 @@
 #if ENABLE(WORKERS) && ENABLE(INDEXED_DATABASE)
 
 #include "Supplementable.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -45,11 +46,12 @@ public:
     static IDBFactory* indexedDB(ScriptExecutionContext*);
 
 private:
-    WorkerGlobalScopeIndexedDatabase();
+    explicit WorkerGlobalScopeIndexedDatabase(const String& databaseDirectoryIdentifier);
 
     IDBFactory* indexedDB();
     static const char* supplementName();
 
+    String m_databaseDirectoryIdentifier;
     RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
     RefPtr<IDBFactory> m_idbFactory;
 };
index e70ae5b..cfbf271 100644 (file)
@@ -367,13 +367,13 @@ enum IDBLevelDBBackingStoreOpenResult {
     IDBLevelDBBackingStoreOpenMax,
 };
 
-PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(SecurityOrigin* securityOrigin, const String& pathBaseArg, const String& fileIdentifier)
+PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(const SecurityOrigin& securityOrigin, const String& pathBaseArg, const String& fileIdentifier)
 {
     DefaultLevelDBFactory levelDBFactory;
     return IDBBackingStoreLevelDB::open(securityOrigin, pathBaseArg, fileIdentifier, &levelDBFactory);
 }
 
-PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(SecurityOrigin* securityOrigin, const String& pathBaseArg, const String& fileIdentifier, LevelDBFactory* levelDBFactory)
+PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(const SecurityOrigin& securityOrigin, const String& pathBaseArg, const String& fileIdentifier, LevelDBFactory* levelDBFactory)
 {
     LOG(StorageAPI, "IDBBackingStoreLevelDB::open");
     ASSERT(!pathBaseArg.isEmpty());
@@ -390,7 +390,7 @@ PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(SecurityOrigin*
         return PassRefPtr<IDBBackingStoreLevelDB>();
     }
 
-    String path = pathByAppendingComponent(pathBase, securityOrigin->databaseIdentifier() + ".indexeddb.leveldb");
+    String path = pathByAppendingComponent(pathBase, securityOrigin.databaseIdentifier() + ".indexeddb.leveldb");
 
     db = levelDBFactory->openLevelDB(path, comparator.get());
     if (db) {
@@ -437,13 +437,13 @@ PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::open(SecurityOrigin*
     return create(fileIdentifier, db.release(), comparator.release());
 }
 
-PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::openInMemory(SecurityOrigin* securityOrigin, const String& identifier)
+PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::openInMemory(const String& identifier)
 {
     DefaultLevelDBFactory levelDBFactory;
-    return IDBBackingStoreLevelDB::openInMemory(securityOrigin, identifier, &levelDBFactory);
+    return IDBBackingStoreLevelDB::openInMemory(identifier, &levelDBFactory);
 }
 
-PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::openInMemory(SecurityOrigin*, const String& identifier, LevelDBFactory*)
+PassRefPtr<IDBBackingStoreLevelDB> IDBBackingStoreLevelDB::openInMemory(const String& identifier, LevelDBFactory*)
 {
     LOG(StorageAPI, "IDBBackingStoreLevelDB::openInMemory");
 
index 1ac098e..29bac02 100644 (file)
@@ -61,10 +61,10 @@ public:
     class Transaction;
 
     virtual ~IDBBackingStoreLevelDB();
-    static PassRefPtr<IDBBackingStoreLevelDB> open(SecurityOrigin*, const String& pathBase, const String& fileIdentifier);
-    static PassRefPtr<IDBBackingStoreLevelDB> open(SecurityOrigin*, const String& pathBase, const String& fileIdentifier, LevelDBFactory*);
-    static PassRefPtr<IDBBackingStoreLevelDB> openInMemory(SecurityOrigin*, const String& identifier);
-    static PassRefPtr<IDBBackingStoreLevelDB> openInMemory(SecurityOrigin*, const String& identifier, LevelDBFactory*);
+    static PassRefPtr<IDBBackingStoreLevelDB> open(const SecurityOrigin&, const String& pathBase, const String& fileIdentifier);
+    static PassRefPtr<IDBBackingStoreLevelDB> open(const SecurityOrigin&, const String& pathBase, const String& fileIdentifier, LevelDBFactory*);
+    static PassRefPtr<IDBBackingStoreLevelDB> openInMemory(const String& identifier);
+    static PassRefPtr<IDBBackingStoreLevelDB> openInMemory(const String& identifier, LevelDBFactory*);
     WeakPtr<IDBBackingStoreLevelDB> createWeakPtr() { return m_weakFactory.createWeakPtr(); }
 
     virtual Vector<String> getDatabaseNames();
index 864961d..25e498c 100644 (file)
@@ -56,18 +56,19 @@ static void cleanWeakMap(HashMap<K, WeakPtr<M> >& map)
     }
 }
 
-static String computeFileIdentifier(SecurityOrigin* securityOrigin)
+static String computeFileIdentifier(const SecurityOrigin& securityOrigin)
 {
     static const char levelDBFileSuffix[] = "@1";
-    return securityOrigin->databaseIdentifier() + levelDBFileSuffix;
+    return securityOrigin.databaseIdentifier() + levelDBFileSuffix;
 }
 
-static String computeUniqueIdentifier(const String& name, SecurityOrigin* securityOrigin)
+static String computeUniqueIdentifier(const String& name, const SecurityOrigin& securityOrigin)
 {
     return computeFileIdentifier(securityOrigin) + name;
 }
 
-IDBFactoryBackendLevelDB::IDBFactoryBackendLevelDB()
+IDBFactoryBackendLevelDB::IDBFactoryBackendLevelDB(const String& databaseDirectory)
+    : m_databaseDirectory(databaseDirectory)
 {
 }
 
@@ -83,8 +84,9 @@ void IDBFactoryBackendLevelDB::removeIDBDatabaseBackend(const String& uniqueIden
 
 void IDBFactoryBackendLevelDB::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory)
 {
+    ASSERT(securityOrigin);
     LOG(StorageAPI, "IDBFactoryBackendLevelDB::getDatabaseNames");
-    RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(securityOrigin, dataDirectory);
+    RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(*securityOrigin, dataDirectory);
     if (!backingStore) {
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error opening backing store for indexedDB.webkitGetDatabaseNames."));
         return;
@@ -102,7 +104,7 @@ void IDBFactoryBackendLevelDB::getDatabaseNames(PassRefPtr<IDBCallbacks> callbac
 void IDBFactoryBackendLevelDB::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory)
 {
     LOG(StorageAPI, "IDBFactoryBackendLevelDB::deleteDatabase");
-    const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get());
+    const String uniqueIdentifier = computeUniqueIdentifier(name, *securityOrigin);
 
     IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentifier);
     if (it != m_databaseBackendMap.end()) {
@@ -113,7 +115,7 @@ void IDBFactoryBackendLevelDB::deleteDatabase(const String& name, PassRefPtr<IDB
     }
 
     // FIXME: Everything from now on should be done on another thread.
-    RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(securityOrigin, dataDirectory);
+    RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(*securityOrigin, dataDirectory);
     if (!backingStore) {
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error opening backing store for indexedDB.deleteDatabase."));
         return;
@@ -128,9 +130,9 @@ void IDBFactoryBackendLevelDB::deleteDatabase(const String& name, PassRefPtr<IDB
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error creating database backend for indexedDB.deleteDatabase."));
 }
 
-PassRefPtr<IDBBackingStoreLevelDB> IDBFactoryBackendLevelDB::openBackingStore(PassRefPtr<SecurityOrigin> securityOrigin, const String& dataDirectory)
+PassRefPtr<IDBBackingStoreLevelDB> IDBFactoryBackendLevelDB::openBackingStore(const SecurityOrigin& securityOrigin, const String& dataDirectory)
 {
-    const String fileIdentifier = computeFileIdentifier(securityOrigin.get());
+    const String fileIdentifier = computeFileIdentifier(securityOrigin);
     const bool openInMemory = dataDirectory.isEmpty();
 
     IDBBackingStoreLevelDBMap::iterator it2 = m_backingStoreMap.find(fileIdentifier);
@@ -139,9 +141,9 @@ PassRefPtr<IDBBackingStoreLevelDB> IDBFactoryBackendLevelDB::openBackingStore(Pa
 
     RefPtr<IDBBackingStoreLevelDB> backingStore;
     if (openInMemory)
-        backingStore = IDBBackingStoreLevelDB::openInMemory(securityOrigin.get(), fileIdentifier);
+        backingStore = IDBBackingStoreLevelDB::openInMemory(fileIdentifier);
     else
-        backingStore = IDBBackingStoreLevelDB::open(securityOrigin.get(), dataDirectory, fileIdentifier);
+        backingStore = IDBBackingStoreLevelDB::open(securityOrigin, dataDirectory, fileIdentifier);
 
     if (backingStore) {
         cleanWeakMap(m_backingStoreMap);
@@ -159,16 +161,15 @@ PassRefPtr<IDBBackingStoreLevelDB> IDBFactoryBackendLevelDB::openBackingStore(Pa
     return 0;
 }
 
-void IDBFactoryBackendLevelDB::open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, ScriptExecutionContext*, const String& dataDirectory)
+void IDBFactoryBackendLevelDB::open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const SecurityOrigin& openingOrigin, const SecurityOrigin&)
 {
     LOG(StorageAPI, "IDBFactoryBackendLevelDB::open");
-    RefPtr<SecurityOrigin> securityOrigin = prpSecurityOrigin;
-    const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get());
+    const String uniqueIdentifier = computeUniqueIdentifier(name, openingOrigin);
 
     RefPtr<IDBDatabaseBackendImpl> databaseBackend;
     IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentifier);
     if (it == m_databaseBackendMap.end()) {
-        RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(securityOrigin, dataDirectory);
+        RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(openingOrigin, m_databaseDirectory);
         if (!backingStore) {
             callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error opening backing store for indexedDB.open."));
             return;
index 03caada..7dc8beb 100644 (file)
@@ -49,9 +49,9 @@ class IDBDatabaseBackendImpl;
 
 class IDBFactoryBackendLevelDB : public IDBFactoryBackendInterface {
 public:
-    static PassRefPtr<IDBFactoryBackendLevelDB> create()
+    static PassRefPtr<IDBFactoryBackendLevelDB> create(const String& databaseDirectory)
     {
-        return adoptRef(new IDBFactoryBackendLevelDB());
+        return adoptRef(new IDBFactoryBackendLevelDB(databaseDirectory));
     }
     virtual ~IDBFactoryBackendLevelDB();
 
@@ -59,18 +59,18 @@ public:
     virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) OVERRIDE FINAL;
 
     virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
-    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
+    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin) OVERRIDE FINAL;
 
     virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
 
     virtual PassRefPtr<IDBTransactionBackendInterface> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode) OVERRIDE FINAL;
 
-
 protected:
-    IDBFactoryBackendLevelDB();
-    virtual PassRefPtr<IDBBackingStoreLevelDB> openBackingStore(PassRefPtr<SecurityOrigin>, const String& dataDir);
+    virtual PassRefPtr<IDBBackingStoreLevelDB> openBackingStore(const SecurityOrigin&, const String& dataDir);
 
 private:
+    explicit IDBFactoryBackendLevelDB(const String& databaseDirectory);
+
     typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap;
     IDBDatabaseBackendMap m_databaseBackendMap;
 
@@ -79,8 +79,7 @@ private:
 
     HashSet<RefPtr<IDBBackingStoreLevelDB> > m_sessionOnlyBackingStores;
 
-    // Only one instance of the factory should exist at any given time.
-    static IDBFactoryBackendLevelDB* idbFactoryBackendImpl;
+    String m_databaseDirectory;
 };
 
 } // namespace WebCore
index 27722cc..9cb4c0c 100644 (file)
@@ -595,7 +595,7 @@ __ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16CSSParserContextC1ERNS_8DocumentERKNS_3URLERKN3WTF6StringE
 __ZN7WebCore16DatabaseStrategy17getDatabaseServerEv
-__ZN7WebCore16DatabaseStrategy23createIDBFactoryBackendEv
+__ZN7WebCore16DatabaseStrategy23createIDBFactoryBackendERKN3WTF6StringE
 __ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
 __ZN7WebCore16DeviceMotionData12RotationRate6createEbdbdbd
 __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
index ac721fc..fb80e58 100644 (file)
@@ -43,12 +43,13 @@ AbstractDatabaseServer* DatabaseStrategy::getDatabaseServer()
 #endif // ENABLE(SQL_DATABASE)
 
 #if ENABLE(INDEXED_DATABASE)
-PassRefPtr<IDBFactoryBackendInterface> DatabaseStrategy::createIDBFactoryBackend()
+PassRefPtr<IDBFactoryBackendInterface> DatabaseStrategy::createIDBFactoryBackend(const String& databaseDirectoryIdentifier)
 {
     // FIXME: Need a better platform abstraction here, but this stop gap will work for now.
 #if USE(LEVELDB)
-    return IDBFactoryBackendLevelDB::create();
+    return IDBFactoryBackendLevelDB::create(databaseDirectoryIdentifier);
 #else
+    UNUSED_PARAM(databaseDirectoryIdentifier);
     return 0;
 #endif
 }
index 95cd661..6b29278 100644 (file)
@@ -27,6 +27,8 @@
 #define DatabaseStrategy_h
 
 #include <wtf/PassRefPtr.h>
+#include <wtf/text/WTFString.h>
+
 namespace WebCore {
 
 class AbstractDatabaseServer;
@@ -39,7 +41,7 @@ public:
 #endif
 
 #if ENABLE(INDEXED_DATABASE)
-    virtual PassRefPtr<IDBFactoryBackendInterface> createIDBFactoryBackend();
+    virtual PassRefPtr<IDBFactoryBackendInterface> createIDBFactoryBackend(const String& databaseDirectoryIdentifier);
 #endif
 
 protected:
index 42c5583..214b967 100644 (file)
@@ -1,3 +1,32 @@
+2013-10-28  Brady Eidson  <beidson@apple.com>
+
+        Refactor IDB factory creation.
+        https://bugs.webkit.org/show_bug.cgi?id=123347
+
+        Reviewed by Andreas Kling.
+
+        - Rework how database directory location is passed around.
+        - Make (some) SecurityOrigin arguments be references instead of pointers.
+        - Add two SecurityOrigin arguments to opening databases for future use.
+
+        * Shared/Databases/IndexedDB/IDBUtilities.cpp:
+        (WebKit::uniqueDatabaseIdentifier):
+        * Shared/Databases/IndexedDB/IDBUtilities.h:
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::WebIDBFactoryBackend::WebIDBFactoryBackend):
+        (WebKit::WebIDBFactoryBackend::open):
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
+        (WebKit::WebIDBFactoryBackend::create):
+
+        * WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.cpp:
+        (WebKit::WebProcessIDBDatabaseBackend::WebProcessIDBDatabaseBackend):
+        * WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.h:
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::createIDBFactoryBackend):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2013-10-28  Tim Horton  <timothy_horton@apple.com>
 
         Make TileController create the appropriate PlatformCALayer subclasses
index 6ee52c6..011e254 100644 (file)
@@ -33,9 +33,9 @@
 
 namespace WebKit {
 
-String uniqueDatabaseIdentifier(const String& databaseName, WebCore::SecurityOrigin* securityOrigin)
+String uniqueDatabaseIdentifier(const String& databaseName, const WebCore::SecurityOrigin& securityOrigin)
 {
-    return securityOrigin->databaseIdentifier() + databaseName;
+    return securityOrigin.databaseIdentifier() + databaseName;
 }
 
 } // namespace WebKit
index a6d4e2a..2edf7eb 100644 (file)
@@ -39,7 +39,7 @@ class SecurityOrigin;
 
 namespace WebKit {
 
-String uniqueDatabaseIdentifier(const String& databaseName, WebCore::SecurityOrigin*);
+String uniqueDatabaseIdentifier(const String& databaseName, const WebCore::SecurityOrigin&);
     
 } // namespace WebKit
 
index a3e8ee2..52be1a1 100644 (file)
@@ -54,7 +54,7 @@ static IDBDatabaseBackendMap& sharedDatabaseBackendMap()
     return databaseBackendMap;
 }
 
-WebIDBFactoryBackend::WebIDBFactoryBackend()
+WebIDBFactoryBackend::WebIDBFactoryBackend(const String&)
 {
 }
 
@@ -69,19 +69,18 @@ void WebIDBFactoryBackend::getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr
     notImplemented();
 }
 
-void WebIDBFactoryBackend::open(const String& databaseName, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, ScriptExecutionContext*, const String&)
+void WebIDBFactoryBackend::open(const String& databaseName, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const SecurityOrigin& securityOrigin, const SecurityOrigin&)
 {
     ASSERT(isMainThread());
     LOG(StorageAPI, "WebIDBFactoryBackend::open");
 
-    RefPtr<SecurityOrigin> securityOrigin = prpSecurityOrigin;
-    String databaseIdentifier = uniqueDatabaseIdentifier(databaseName, securityOrigin.get());
+    String databaseIdentifier = uniqueDatabaseIdentifier(databaseName, securityOrigin);
     
     RefPtr<WebProcessIDBDatabaseBackend> webProcessDatabaseBackend;
     IDBDatabaseBackendMap::iterator it = sharedDatabaseBackendMap().find(databaseIdentifier);
 
     if (it == sharedDatabaseBackendMap().end()) {
-        webProcessDatabaseBackend = WebProcessIDBDatabaseBackend::create(databaseName, securityOrigin.get());
+        webProcessDatabaseBackend = WebProcessIDBDatabaseBackend::create(*this, databaseName);
         webProcessDatabaseBackend->establishDatabaseProcessBackend();
         sharedDatabaseBackendMap().set(databaseIdentifier, webProcessDatabaseBackend.get());
     } else
index dd50461..0cdf9a3 100644 (file)
@@ -35,12 +35,12 @@ namespace WebKit {
 
 class WebIDBFactoryBackend : public WebCore::IDBFactoryBackendInterface {
 public:
-    static PassRefPtr<WebIDBFactoryBackend> create() { return adoptRef(new WebIDBFactoryBackend); }
+    static PassRefPtr<WebIDBFactoryBackend> create(const String& databaseDirectoryIdentifier) { return adoptRef(new WebIDBFactoryBackend(databaseDirectoryIdentifier)); }
 
     virtual ~WebIDBFactoryBackend();
 
     virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
-    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
+    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin) OVERRIDE FINAL;
     virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
 
     virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) OVERRIDE FINAL;
@@ -48,7 +48,7 @@ public:
     virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> maybeCreateTransactionBackend(WebCore::IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const Vector<int64_t>&, WebCore::IndexedDB::TransactionMode);
 
 private:
-    WebIDBFactoryBackend();
+    explicit WebIDBFactoryBackend(const String& databaseDirectoryIdentifier);
 };
 
 } // namespace WebKit
index 3858fd0..bba71f6 100644 (file)
 
 #include "DatabaseProcessIDBDatabaseBackendMessages.h"
 #include "DatabaseToWebProcessConnectionMessages.h"
+#include "WebIDBFactoryBackend.h"
 #include "WebProcess.h"
 #include "WebToDatabaseProcessConnection.h"
+#include <WebCore/IDBMetadata.h>
 #include <WebCore/SecurityOrigin.h>
 
 #if ENABLE(INDEXED_DATABASE)
@@ -46,10 +48,10 @@ static uint64_t generateBackendIdentifier()
     return identifier++;
 }
 
-WebProcessIDBDatabaseBackend::WebProcessIDBDatabaseBackend(const String& name, WebCore::SecurityOrigin* origin)
+WebProcessIDBDatabaseBackend::WebProcessIDBDatabaseBackend(WebIDBFactoryBackend& factory, const String& name)
     : m_databaseName(name)
-    , m_securityOrigin(origin)
     , m_backendIdentifier(generateBackendIdentifier())
+    , m_factory(&factory)
 {
 }
 
index ef74a6f..1a1d272 100644 (file)
@@ -39,41 +39,43 @@ class SecurityOrigin;
 
 namespace WebKit {
 
-class WebProcessIDBDatabaseBackend : public WebCore::IDBDatabaseBackendInterface, public CoreIPC::MessageSender {
+class WebIDBFactoryBackend;
+
+class WebProcessIDBDatabaseBackend FINAL : public WebCore::IDBDatabaseBackendInterface, public CoreIPC::MessageSender {
 public:
-    static PassRefPtr<WebProcessIDBDatabaseBackend> create(const String& name, WebCore::SecurityOrigin* origin) { return adoptRef(new WebProcessIDBDatabaseBackend(name, origin)); }
+    static PassRefPtr<WebProcessIDBDatabaseBackend> create(WebIDBFactoryBackend& factory, const String& name) { return adoptRef(new WebProcessIDBDatabaseBackend(factory, name)); }
 
     virtual ~WebProcessIDBDatabaseBackend();
 
-    virtual void createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const WebCore::IDBKeyPath&, bool autoIncrement);
-    virtual void deleteObjectStore(int64_t transactionId, int64_t objectStoreId);
-    virtual void createTransaction(int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, unsigned short mode);
-    virtual void close(PassRefPtr<WebCore::IDBDatabaseCallbacks>);
+    virtual void createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const WebCore::IDBKeyPath&, bool autoIncrement) OVERRIDE;
+    virtual void deleteObjectStore(int64_t transactionId, int64_t objectStoreId) OVERRIDE;
+    virtual void createTransaction(int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, unsigned short mode) OVERRIDE;
+    virtual void close(PassRefPtr<WebCore::IDBDatabaseCallbacks>) OVERRIDE;
 
     // Transaction-specific operations.
-    virtual void commit(int64_t transactionId);
-    virtual void abort(int64_t transactionId);
-    virtual void abort(int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseError>);
+    virtual void commit(int64_t transactionId) OVERRIDE;
+    virtual void abort(int64_t transactionId) OVERRIDE;
+    virtual void abort(int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseError>) OVERRIDE;
 
-    virtual void createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry);
-    virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId);
+    virtual void createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry) OVERRIDE;
+    virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId) OVERRIDE;
 
-    virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, bool keyOnly, PassRefPtr<WebCore::IDBCallbacks>);
+    virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, bool keyOnly, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
     // Note that 'value' may be consumed/adopted by this call.
-    virtual void put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::SharedBuffer> value, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<WebCore::IndexKeys>&);
-    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<WebCore::IndexKeys>&);
-    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds);
-    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, WebCore::IndexedDB::CursorDirection, bool keyOnly, TaskType, PassRefPtr<WebCore::IDBCallbacks>);
-    virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>);
-    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>);
-    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBCallbacks>);
+    virtual void put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::SharedBuffer> value, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<WebCore::IndexKeys>&) OVERRIDE;
+    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<WebCore::IndexKeys>&) OVERRIDE;
+    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds) OVERRIDE;
+    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, WebCore::IndexedDB::CursorDirection, bool keyOnly, TaskType, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
 
     void openConnection(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, int64_t transactionId, int64_t version);
 
     void establishDatabaseProcessBackend();
 
 private:
-    WebProcessIDBDatabaseBackend(const String& name, WebCore::SecurityOrigin*);
+    WebProcessIDBDatabaseBackend(WebIDBFactoryBackend&, const String& name);
 
     String m_databaseName;
     RefPtr<WebCore::SecurityOrigin> m_securityOrigin;
@@ -83,6 +85,8 @@ private:
     virtual uint64_t messageSenderDestinationID() OVERRIDE { return m_backendIdentifier; }
 
     uint64_t m_backendIdentifier;
+
+    RefPtr<WebIDBFactoryBackend> m_factory;
 };
 
 } // namespace WebKit
index 9f2785c..8c26d5b 100644 (file)
@@ -217,13 +217,13 @@ AbstractDatabaseServer* WebPlatformStrategies::getDatabaseServer()
 #endif // ENABLE(SQL_DATABASE)
 
 #if ENABLE(INDEXED_DATABASE)
-PassRefPtr<IDBFactoryBackendInterface> WebPlatformStrategies::createIDBFactoryBackend()
+PassRefPtr<IDBFactoryBackendInterface> WebPlatformStrategies::createIDBFactoryBackend(const String& databaseDirectoryIdentifier)
 {
 #if !ENABLE(DATABASE_PROCESS)
-    return DatabaseStrategy::createIDBFactoryBackend();
+    return DatabaseStrategy::createIDBFactoryBackend(databaseDirectoryIdentifier);
 #endif
 
-    return WebIDBFactoryBackend::create();
+    return WebIDBFactoryBackend::create(databaseDirectoryIdentifier);
 }
 #endif // ENABLE(INDEXED_DATABASE)
 
index df0b77b..19e1104 100644 (file)
@@ -68,7 +68,7 @@ private:
     virtual WebCore::AbstractDatabaseServer* getDatabaseServer() OVERRIDE;
 #endif
 #if ENABLE(INDEXED_DATABASE)
-    virtual PassRefPtr<WebCore::IDBFactoryBackendInterface> createIDBFactoryBackend() OVERRIDE;
+    virtual PassRefPtr<WebCore::IDBFactoryBackendInterface> createIDBFactoryBackend(const String& databaseDirectoryIdentifier) OVERRIDE;
 #endif
 
     // WebCore::LoaderStrategy