summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp')
-rw-r--r--Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp b/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
index 2074b15c5..4ab415653 100644
--- a/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
+++ b/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
@@ -11,10 +11,10 @@
* 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 COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* 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
@@ -27,19 +27,20 @@
#include "config.h"
-#if ENABLE(INDEXED_DATABASE)
+#if ENABLE(INDEXED_DATABASE_IN_WORKERS)
#include "WorkerGlobalScopeIndexedDatabase.h"
+#include "IDBConnectionProxy.h"
#include "IDBFactory.h"
-#include "IDBFactoryBackendInterface.h"
+#include "IDBOpenDBRequest.h"
#include "ScriptExecutionContext.h"
-#include "SecurityOrigin.h"
+#include "WorkerGlobalScope.h"
namespace WebCore {
-WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase(const String& databaseDirectoryIdentifier)
- : m_databaseDirectoryIdentifier(databaseDirectoryIdentifier)
+WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase(WorkerGlobalScope&, IDBClient::IDBConnectionProxy& connectionProxy)
+ : m_connectionProxy(connectionProxy)
{
}
@@ -52,36 +53,35 @@ const char* WorkerGlobalScopeIndexedDatabase::supplementName()
return "WorkerGlobalScopeIndexedDatabase";
}
-WorkerGlobalScopeIndexedDatabase* WorkerGlobalScopeIndexedDatabase::from(ScriptExecutionContext* context)
+WorkerGlobalScopeIndexedDatabase* WorkerGlobalScopeIndexedDatabase::from(WorkerGlobalScope& scope)
{
- WorkerGlobalScopeIndexedDatabase* supplement = static_cast<WorkerGlobalScopeIndexedDatabase*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
+ WorkerGlobalScopeIndexedDatabase* supplement = static_cast<WorkerGlobalScopeIndexedDatabase*>(Supplement<WorkerGlobalScope>::from(&scope, supplementName()));
if (!supplement) {
- String databaseDirectoryIdentifier;
- WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
- const GroupSettings* groupSettings = workerGlobalScope->groupSettings();
- if (groupSettings)
- databaseDirectoryIdentifier = groupSettings->indexedDBDatabasePath();
+ auto* connectionProxy = scope.idbConnectionProxy();
+ if (!connectionProxy)
+ return nullptr;
- supplement = new WorkerGlobalScopeIndexedDatabase(databaseDirectoryIdentifier);
- provideTo(context, supplementName(), adoptPtr(supplement));
+ auto newSupplement = std::make_unique<WorkerGlobalScopeIndexedDatabase>(scope, *connectionProxy);
+ supplement = newSupplement.get();
+ provideTo(&scope, supplementName(), WTFMove(newSupplement));
}
return supplement;
}
-IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB(ScriptExecutionContext* context)
+IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB(WorkerGlobalScope& scope)
{
- return from(context)->indexedDB();
+ auto* scopeIDB = from(scope);
+ return scopeIDB ? scopeIDB->indexedDB() : nullptr;
}
IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB()
{
- if (!m_factoryBackend)
- m_factoryBackend = IDBFactoryBackendInterface::create(m_databaseDirectoryIdentifier);
if (!m_idbFactory)
- m_idbFactory = IDBFactory::create(m_factoryBackend.get());
+ m_idbFactory = IDBFactory::create(m_connectionProxy.get());
+
return m_idbFactory.get();
}
} // namespace WebCore
-#endif // ENABLE(INDEXED_DATABASE)
+#endif // ENABLE(INDEXED_DATABASE_IN_WORKERS)