Diff
Modified: trunk/Source/WebCore/ChangeLog (199881 => 199882)
--- trunk/Source/WebCore/ChangeLog 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/ChangeLog 2016-04-22 18:06:04 UTC (rev 199882)
@@ -1,3 +1,33 @@
+2016-04-22 Brady Eidson <beid...@apple.com>
+
+ Modern IDB: Rework the ownership/RefCounting model of IDBConnectionToServer and IDBConnectionProxy.
+ https://bugs.webkit.org/show_bug.cgi?id=156916
+
+ Reviewed by Tim Horton.
+
+ No new tests (No behavior change).
+
+ * Modules/indexeddb/IDBFactory.cpp: Remove unneeded include.
+
+ * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+ (WebCore::IDBClient::IDBConnectionProxy::ref): Ref the ConnectionToServer.
+ (WebCore::IDBClient::IDBConnectionProxy::deref): Deref it.
+ (WebCore::IDBClient::IDBConnectionProxy::connectionToServer):
+ (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
+ (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
+ (WebCore::IDBClient::IDBConnectionProxy::create): Deleted.
+ * Modules/indexeddb/client/IDBConnectionProxy.h:
+
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer): Create a proxy owned by this.
+ (WebCore::IDBClient::IDBConnectionToServer::proxy): Expose it.
+ * Modules/indexeddb/client/IDBConnectionToServer.h:
+
+ * dom/Document.cpp:
+ (WebCore::Document::idbConnectionProxy):
+
+ * WebCore.xcodeproj/project.pbxproj:
+
2016-04-22 Antti Koivisto <an...@apple.com>
REGRESSION (r194898): Multi download of external SVG defs file by <use> xlinks:href (caching)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (199881 => 199882)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-22 18:06:04 UTC (rev 199882)
@@ -32,7 +32,6 @@
#include "ExceptionCode.h"
#include "IDBBindingUtilities.h"
#include "IDBConnectionProxy.h"
-#include "IDBConnectionToServer.h"
#include "IDBDatabaseIdentifier.h"
#include "IDBKey.h"
#include "IDBOpenDBRequest.h"
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp (199881 => 199882)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2016-04-22 18:06:04 UTC (rev 199882)
@@ -34,11 +34,6 @@
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())
@@ -46,13 +41,23 @@
ASSERT(isMainThread());
}
+void IDBConnectionProxy::ref()
+{
+ m_connectionToServer.ref();
+}
+
+void IDBConnectionProxy::deref()
+{
+ m_connectionToServer.deref();
+}
+
// FIXME: Temporarily required during bringup of IDB-in-Workers.
// Once all IDB object reliance on the IDBConnectionToServer has been shifted to reliance on
// IDBConnectionProxy, remove this.
IDBConnectionToServer& IDBConnectionProxy::connectionToServer()
{
ASSERT(isMainThread());
- return m_connectionToServer.get();
+ return m_connectionToServer;
}
RefPtr<IDBOpenDBRequest> IDBConnectionProxy::openDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version)
@@ -62,7 +67,7 @@
return nullptr;
auto request = IDBOpenDBRequest::createOpenRequest(context, *this, databaseIdentifier, version);
- m_connectionToServer->openDatabase(request.get());
+ m_connectionToServer.openDatabase(request.get());
return WTFMove(request);
}
@@ -73,7 +78,7 @@
return nullptr;
auto request = IDBOpenDBRequest::createDeleteRequest(context, *this, databaseIdentifier);
- m_connectionToServer->deleteDatabase(request.get());
+ m_connectionToServer.deleteDatabase(request.get());
return WTFMove(request);
}
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (199881 => 199882)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2016-04-22 18:06:04 UTC (rev 199882)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBConnectionToServer.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -37,9 +38,11 @@
namespace IDBClient {
-class IDBConnectionProxy : public ThreadSafeRefCounted<IDBConnectionProxy> {
+class IDBConnectionToServer;
+
+class IDBConnectionProxy {
public:
- static Ref<IDBConnectionProxy> create(IDBConnectionToServer&);
+ IDBConnectionProxy(IDBConnectionToServer&);
RefPtr<IDBOpenDBRequest> openDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&);
@@ -51,10 +54,11 @@
// IDBConnectionProxy, remove this.
IDBConnectionToServer& connectionToServer();
+ void ref();
+ void deref();
+
private:
- IDBConnectionProxy(IDBConnectionToServer&);
-
- Ref<IDBConnectionToServer> m_connectionToServer;
+ IDBConnectionToServer& m_connectionToServer;
uint64_t m_serverConnectionIdentifier;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (199881 => 199882)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2016-04-22 18:06:04 UTC (rev 199882)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBConnectionProxy.h"
#include "IDBDatabase.h"
#include "IDBKeyRangeData.h"
#include "IDBOpenDBRequest.h"
@@ -46,6 +47,7 @@
IDBConnectionToServer::IDBConnectionToServer(IDBConnectionToServerDelegate& delegate)
: m_delegate(delegate)
+ , m_proxy(std::make_unique<IDBConnectionProxy>(*this))
{
}
@@ -54,13 +56,19 @@
return m_delegate->identifier();
}
+IDBConnectionProxy& IDBConnectionToServer::proxy()
+{
+ ASSERT(m_proxy);
+ return *m_proxy;
+}
+
void IDBConnectionToServer::deleteDatabase(IDBOpenDBRequest& request)
{
LOG(IndexedDB, "IDBConnectionToServer::deleteDatabase - %s", request.databaseIdentifier().debugString().utf8().data());
ASSERT(!m_openDBRequestMap.contains(request.resourceIdentifier()));
m_openDBRequestMap.set(request.resourceIdentifier(), &request);
-
+
IDBRequestData requestData(*this, request);
m_delegate->deleteDatabase(requestData);
}
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (199881 => 199882)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2016-04-22 18:06:04 UTC (rev 199882)
@@ -27,6 +27,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBConnectionProxy.h"
#include "IDBConnectionToServerDelegate.h"
#include "IDBResourceIdentifier.h"
#include "TransactionOperation.h"
@@ -56,6 +57,8 @@
uint64_t identifier() const;
+ IDBConnectionProxy& proxy();
+
void deleteDatabase(IDBOpenDBRequest&);
WEBCORE_EXPORT void didDeleteDatabase(const IDBResultData&);
@@ -136,6 +139,8 @@
HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_committingTransactions;
HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_abortingTransactions;
HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_activeOperations;
+
+ std::unique_ptr<IDBConnectionProxy> m_proxy;
};
} // namespace IDBClient
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (199881 => 199882)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-04-22 18:06:04 UTC (rev 199882)
@@ -2086,7 +2086,7 @@
517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
517B25A91CC82B2A0061C011 /* IDBConnectionProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517B25A71CC820320061C011 /* IDBConnectionProxy.cpp */; };
- 517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B25A81CC820320061C011 /* IDBConnectionProxy.h */; };
+ 517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B25A81CC820320061C011 /* IDBConnectionProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
517FBA1E151AB17C00B57959 /* DOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517FBA17151AA71B00B57959 /* DOMWindowExtension.cpp */; };
5185FC741BB4C4E80012898F /* DOMWindowIndexedDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D7196C181106DF0016DC51 /* DOMWindowIndexedDatabase.cpp */; };
5185FC751BB4C4E80012898F /* DOMWindowIndexedDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D7196D181106DF0016DC51 /* DOMWindowIndexedDatabase.h */; };
Modified: trunk/Source/WebCore/dom/Document.cpp (199881 => 199882)
--- trunk/Source/WebCore/dom/Document.cpp 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-04-22 18:06:04 UTC (rev 199882)
@@ -3068,7 +3068,7 @@
if (!currentPage)
return nullptr;
- m_idbConnectionProxy = IDBClient::IDBConnectionProxy::create(currentPage->idbConnection());
+ m_idbConnectionProxy = ¤tPage->idbConnection().proxy();
}
return m_idbConnectionProxy.get();
Modified: trunk/Source/WebKit2/ChangeLog (199881 => 199882)
--- trunk/Source/WebKit2/ChangeLog 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-22 18:06:04 UTC (rev 199882)
@@ -1,3 +1,13 @@
+2016-04-22 Brady Eidson <beid...@apple.com>
+
+ Modern IDB: Rework the ownership/RefCounting model of IDBConnectionToServer and IDBConnectionProxy.
+ https://bugs.webkit.org/show_bug.cgi?id=156916
+
+ Reviewed by Tim Horton.
+
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+ (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
+
2016-04-22 Zan Dobersek <zdober...@igalia.com>
NetworkCacheIOChannelSoup: detach the newly-created IOChannel::readSync thread
Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (199881 => 199882)
--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp 2016-04-22 17:37:09 UTC (rev 199881)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp 2016-04-22 18:06:04 UTC (rev 199882)
@@ -60,9 +60,9 @@
WebIDBConnectionToServer::WebIDBConnectionToServer()
{
relaxAdoptionRequirement();
- m_connectionToServer = IDBClient::IDBConnectionToServer::create(*this);
m_isOpenInServer = sendSync(Messages::DatabaseToWebProcessConnection::EstablishIDBConnectionToServer(), m_identifier);
+ m_connectionToServer = IDBClient::IDBConnectionToServer::create(*this);
}
WebIDBConnectionToServer::~WebIDBConnectionToServer()