Diff
Modified: trunk/LayoutTests/ChangeLog (199834 => 199835)
--- trunk/LayoutTests/ChangeLog 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/LayoutTests/ChangeLog 2016-04-21 21:08:20 UTC (rev 199835)
@@ -1,3 +1,12 @@
+2016-04-21 Brady Eidson <beid...@apple.com>
+
+ Modern IDB (Workers): More IDBConnectionProxy refactoring.
+ https://bugs.webkit.org/show_bug.cgi?id=156855
+
+ Reviewed by Darin Adler.
+
+ * storage/indexeddb/modern/workers-enable-expected.txt: Revert some of the PASS expectations to FAIL, just for now.
+
2016-04-21 Ryan Haddad <ryanhad...@apple.com>
Skip <area ping> tests on ios-simulator
Modified: trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt (199834 => 199835)
--- trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt 2016-04-21 21:08:20 UTC (rev 199835)
@@ -5,8 +5,8 @@
Starting worker: resources/workers-enable.js
PASS [Worker] self.indexedDB is defined.
-PASS [Worker] self.indexedDB is non-null.
-PASS [Worker] self.indexedDB instanceof IDBFactory is true
+FAIL [Worker] self.indexedDB should be non-null. Was null
+FAIL [Worker] self.indexedDB instanceof IDBFactory should be true. Was false.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/Source/WebCore/ChangeLog (199834 => 199835)
--- trunk/Source/WebCore/ChangeLog 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/ChangeLog 2016-04-21 21:08:20 UTC (rev 199835)
@@ -1,3 +1,39 @@
+2016-04-21 Brady Eidson <beid...@apple.com>
+
+ Modern IDB (Workers): More IDBConnectionProxy refactoring.
+ https://bugs.webkit.org/show_bug.cgi?id=156855
+
+ Reviewed by Darin Adler.
+
+ No new tests (Covered by changes to existing tests).
+
+ * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+ (WebCore::DOMWindowIndexedDatabase::indexedDB):
+
+ Hang on to the IDBConnectionProxy passed in at creation time, as it should never change:
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::create):
+ (WebCore::IDBFactory::IDBFactory):
+ (WebCore::IDBFactory::openInternal):
+ (WebCore::IDBFactory::deleteDatabase):
+ * Modules/indexeddb/IDBFactory.h:
+
+ Hang on to the IDBConnectionProxy passed in at creation time, as it should never change:
+ * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
+ (WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
+ (WebCore::WorkerGlobalScopeIndexedDatabase::from):
+ (WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
+ * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
+
+ Make IDBConnectionProxy ThreadSafeRefCounted:
+ * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+ (WebCore::IDBClient::IDBConnectionProxy::create):
+ * Modules/indexeddb/client/IDBConnectionProxy.h:
+
+ * dom/Document.cpp:
+ (WebCore::Document::idbConnectionProxy):
+ * dom/Document.h:
+
2016-04-21 Keith Miller <keith_mil...@apple.com>
WebScriptObject description swizzler should work in a multi-threaded world
Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp 2016-04-21 21:08:20 UTC (rev 199835)
@@ -111,9 +111,14 @@
if (!m_window->isCurrentlyDisplayedInFrame())
return nullptr;
- if (!m_idbFactory)
- m_idbFactory = IDBFactory::create();
+ if (!m_idbFactory) {
+ auto* connectionProxy = document->idbConnectionProxy();
+ if (!connectionProxy)
+ return nullptr;
+ m_idbFactory = IDBFactory::create(*connectionProxy);
+ }
+
return m_idbFactory.get();
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-21 21:08:20 UTC (rev 199835)
@@ -63,12 +63,13 @@
return false;
}
-Ref<IDBFactory> IDBFactory::create()
+Ref<IDBFactory> IDBFactory::create(IDBClient::IDBConnectionProxy& connectionProxy)
{
- return adoptRef(*new IDBFactory);
+ return adoptRef(*new IDBFactory(connectionProxy));
}
-IDBFactory::IDBFactory()
+IDBFactory::IDBFactory(IDBClient::IDBConnectionProxy& connectionProxy)
+ : m_connectionProxy(connectionProxy)
{
}
@@ -119,14 +120,7 @@
return nullptr;
}
- auto* connectionProxy = context.idbConnectionProxy();
- if (!connectionProxy) {
- ec.code = SECURITY_ERR;
- ec.message = ASCIILiteral("IDBFactory.open() called at an invalid time");
- return nullptr;
- }
-
- return connectionProxy->openDatabase(context, databaseIdentifier, version);
+ return m_connectionProxy->openDatabase(context, databaseIdentifier, version);
}
RefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext& context, const String& name, ExceptionCodeWithMessage& ec)
@@ -153,14 +147,7 @@
return nullptr;
}
- auto* connectionProxy = context.idbConnectionProxy();
- if (!connectionProxy) {
- ec.code = SECURITY_ERR;
- ec.message = ASCIILiteral("IDBFactory.deleteDatabase() called at an invalid time");
- return nullptr;
- }
-
- return connectionProxy->deleteDatabase(context, databaseIdentifier);
+ return m_connectionProxy->deleteDatabase(context, databaseIdentifier);
}
short IDBFactory::cmp(ScriptExecutionContext& context, JSValue firstValue, JSValue secondValue, ExceptionCodeWithMessage& ec)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2016-04-21 21:08:20 UTC (rev 199835)
@@ -43,14 +43,14 @@
struct ExceptionCodeWithMessage;
namespace IDBClient {
-class IDBConnectionToServer;
+class IDBConnectionProxy;
}
typedef int ExceptionCode;
class IDBFactory : public ThreadSafeRefCounted<IDBFactory> {
public:
- static Ref<IDBFactory> create();
+ static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
~IDBFactory();
RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
@@ -60,9 +60,11 @@
short cmp(ScriptExecutionContext&, JSC::JSValue first, JSC::JSValue second, ExceptionCodeWithMessage&);
private:
- explicit IDBFactory();
+ explicit IDBFactory(IDBClient::IDBConnectionProxy&);
RefPtr<IDBOpenDBRequest> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCodeWithMessage&);
+
+ Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp 2016-04-21 21:08:20 UTC (rev 199835)
@@ -31,14 +31,17 @@
#include "WorkerGlobalScopeIndexedDatabase.h"
+#include "IDBConnectionProxy.h"
#include "IDBFactory.h"
+#include "IDBOpenDBRequest.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
#include "WorkerGlobalScope.h"
namespace WebCore {
-WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase(WorkerGlobalScope&)
+WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase(WorkerGlobalScope&, IDBClient::IDBConnectionProxy& connectionProxy)
+ : m_connectionProxy(connectionProxy)
{
}
@@ -55,7 +58,11 @@
{
WorkerGlobalScopeIndexedDatabase* supplement = static_cast<WorkerGlobalScopeIndexedDatabase*>(Supplement<WorkerGlobalScope>::from(&scope, supplementName()));
if (!supplement) {
- auto newSupplement = std::make_unique<WorkerGlobalScopeIndexedDatabase>(scope);
+ auto* connectionProxy = scope.idbConnectionProxy();
+ if (!connectionProxy)
+ return nullptr;
+
+ auto newSupplement = std::make_unique<WorkerGlobalScopeIndexedDatabase>(scope, *connectionProxy);
supplement = newSupplement.get();
provideTo(&scope, supplementName(), WTFMove(newSupplement));
}
@@ -64,13 +71,14 @@
IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB(WorkerGlobalScope& scope)
{
- return from(scope)->indexedDB();
+ auto* scopeIDB = from(scope);
+ return scopeIDB ? scopeIDB->indexedDB() : nullptr;
}
IDBFactory* WorkerGlobalScopeIndexedDatabase::indexedDB()
{
if (!m_idbFactory)
- m_idbFactory = IDBFactory::create();
+ m_idbFactory = IDBFactory::create(m_connectionProxy.get());
return m_idbFactory.get();
}
Modified: trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h 2016-04-21 21:08:20 UTC (rev 199835)
@@ -36,19 +36,25 @@
class IDBFactory;
class WorkerGlobalScope;
+namespace IDBClient {
+class IDBConnectionProxy;
+}
+
class WorkerGlobalScopeIndexedDatabase : public Supplement<WorkerGlobalScope> {
public:
- explicit WorkerGlobalScopeIndexedDatabase(WorkerGlobalScope&);
+ explicit WorkerGlobalScopeIndexedDatabase(WorkerGlobalScope&, IDBClient::IDBConnectionProxy&);
virtual ~WorkerGlobalScopeIndexedDatabase();
- static WorkerGlobalScopeIndexedDatabase* from(WorkerGlobalScope&);
static IDBFactory* indexedDB(WorkerGlobalScope&);
private:
IDBFactory* indexedDB();
+
static const char* supplementName();
+ static WorkerGlobalScopeIndexedDatabase* from(WorkerGlobalScope&);
RefPtr<IDBFactory> m_idbFactory;
+ Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2016-04-21 21:08:20 UTC (rev 199835)
@@ -34,6 +34,11 @@
namespace WebCore {
namespace IDBClient {
+Ref<IDBConnectionProxy> IDBConnectionProxy::create(IDBConnectionToServer& connection)
+{
+ return adoptRef(*new IDBConnectionProxy(connection));
+}
+
IDBConnectionProxy::IDBConnectionProxy(IDBConnectionToServer& connection)
: m_connectionToServer(connection)
, m_serverConnectionIdentifier(connection.identifier())
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (199834 => 199835)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2016-04-21 21:08:20 UTC (rev 199835)
@@ -37,10 +37,9 @@
namespace IDBClient {
-class IDBConnectionProxy {
- WTF_MAKE_NONCOPYABLE(IDBConnectionProxy);
+class IDBConnectionProxy : public ThreadSafeRefCounted<IDBConnectionProxy> {
public:
- IDBConnectionProxy(IDBConnectionToServer&);
+ static Ref<IDBConnectionProxy> create(IDBConnectionToServer&);
RefPtr<IDBOpenDBRequest> openDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&);
@@ -53,6 +52,8 @@
IDBConnectionToServer& connectionToServer();
private:
+ IDBConnectionProxy(IDBConnectionToServer&);
+
Ref<IDBConnectionToServer> m_connectionToServer;
uint64_t m_serverConnectionIdentifier;
};
Modified: trunk/Source/WebCore/dom/Document.cpp (199834 => 199835)
--- trunk/Source/WebCore/dom/Document.cpp 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-04-21 21:08:20 UTC (rev 199835)
@@ -3116,7 +3116,7 @@
if (!currentPage)
return nullptr;
- m_idbConnectionProxy = std::make_unique<IDBClient::IDBConnectionProxy>(currentPage->idbConnection());
+ m_idbConnectionProxy = IDBClient::IDBConnectionProxy::create(currentPage->idbConnection());
}
return m_idbConnectionProxy.get();
Modified: trunk/Source/WebCore/dom/Document.h (199834 => 199835)
--- trunk/Source/WebCore/dom/Document.h 2016-04-21 21:00:02 UTC (rev 199834)
+++ trunk/Source/WebCore/dom/Document.h 2016-04-21 21:08:20 UTC (rev 199835)
@@ -1781,7 +1781,7 @@
#endif
#if ENABLE(INDEXED_DATABASE)
- std::unique_ptr<IDBClient::IDBConnectionProxy> m_idbConnectionProxy;
+ RefPtr<IDBClient::IDBConnectionProxy> m_idbConnectionProxy;
#endif
};