Title: [249803] trunk/Source
Revision
249803
Author
you...@apple.com
Date
2019-09-12 01:47:31 -0700 (Thu, 12 Sep 2019)

Log Message

Use typed identifiers for IDB connection identifiers
https://bugs.webkit.org/show_bug.cgi?id=201682

Reviewed by Chris Dumez.

Source/WebCore:

Migrate from uint64_t to a typed identifier for IDB connection identifiers.
The identifier is reusing the process identifier type.
No change of behavior.

* Modules/indexeddb/client/IDBConnectionProxy.h:
(WebCore::IDBClient::IDBConnectionProxy::serverConnectionIdentifier const):
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::identifier const):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::identifier const):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::getAllDatabaseNames):
(WebCore::IDBServer::IDBServer::performGetAllDatabaseNames):
(WebCore::IDBServer::IDBServer::didGetAllDatabaseNames):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/shared/IDBRequestData.cpp:
(WebCore::IDBRequestData::serverConnectionIdentifier const):
* Modules/indexeddb/shared/IDBRequestData.h:
* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
(WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
(WebCore::IDBResourceIdentifier::emptyValue):
(WebCore::IDBResourceIdentifier::deletedValue):
(WebCore::IDBResourceIdentifier::isHashTableDeletedValue const):
(WebCore::IDBResourceIdentifier::loggingString const):
* Modules/indexeddb/shared/IDBResourceIdentifier.h:
(WebCore::IDBResourceIdentifier::hash const):
(WebCore::IDBResourceIdentifier::connectionIdentifier const):
(WTF::crossThreadCopy):
* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::identifier const):
* Modules/indexeddb/shared/InProcessIDBServer.h:

Source/WebKit:

Remove no longer needed conversion from process identifier to idb connection identifier.

* NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::identifier const):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249802 => 249803)


--- trunk/Source/WebCore/ChangeLog	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/ChangeLog	2019-09-12 08:47:31 UTC (rev 249803)
@@ -1,5 +1,48 @@
 2019-09-12  Youenn Fablet  <you...@apple.com>
 
+        Use typed identifiers for IDB connection identifiers
+        https://bugs.webkit.org/show_bug.cgi?id=201682
+
+        Reviewed by Chris Dumez.
+
+        Migrate from uint64_t to a typed identifier for IDB connection identifiers.
+        The identifier is reusing the process identifier type.
+        No change of behavior.
+
+        * Modules/indexeddb/client/IDBConnectionProxy.h:
+        (WebCore::IDBClient::IDBConnectionProxy::serverConnectionIdentifier const):
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::identifier const):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::identifier const):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::getAllDatabaseNames):
+        (WebCore::IDBServer::IDBServer::performGetAllDatabaseNames):
+        (WebCore::IDBServer::IDBServer::didGetAllDatabaseNames):
+        * Modules/indexeddb/server/IDBServer.h:
+        * Modules/indexeddb/shared/IDBRequestData.cpp:
+        (WebCore::IDBRequestData::serverConnectionIdentifier const):
+        * Modules/indexeddb/shared/IDBRequestData.h:
+        * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
+        (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
+        (WebCore::IDBResourceIdentifier::emptyValue):
+        (WebCore::IDBResourceIdentifier::deletedValue):
+        (WebCore::IDBResourceIdentifier::isHashTableDeletedValue const):
+        (WebCore::IDBResourceIdentifier::loggingString const):
+        * Modules/indexeddb/shared/IDBResourceIdentifier.h:
+        (WebCore::IDBResourceIdentifier::hash const):
+        (WebCore::IDBResourceIdentifier::connectionIdentifier const):
+        (WTF::crossThreadCopy):
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::identifier const):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+2019-09-12  Youenn Fablet  <you...@apple.com>
+
         Use WebProcess processIdentifier to identify Service Worker connections
         https://bugs.webkit.org/show_bug.cgi?id=201459
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -111,7 +111,7 @@
 
     void completeOperation(const IDBResultData&);
 
-    uint64_t serverConnectionIdentifier() const { return m_serverConnectionIdentifier; }
+    IDBConnectionIdentifier serverConnectionIdentifier() const { return m_serverConnectionIdentifier; }
 
     void ref();
     void deref();
@@ -153,7 +153,7 @@
     void handleMainThreadTasks();
 
     IDBConnectionToServer& m_connectionToServer;
-    uint64_t m_serverConnectionIdentifier;
+    IDBConnectionIdentifier m_serverConnectionIdentifier;
 
     HashMap<uint64_t, IDBDatabase*> m_databaseConnectionMap;
     Lock m_databaseConnectionMapLock;

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -54,7 +54,7 @@
 {
 }
 
-uint64_t IDBConnectionToServer::identifier() const
+IDBConnectionIdentifier IDBConnectionToServer::identifier() const
 {
     return m_delegate->identifier();
 }

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -55,7 +55,7 @@
 public:
     WEBCORE_EXPORT static Ref<IDBConnectionToServer> create(IDBConnectionToServerDelegate&);
 
-    WEBCORE_EXPORT uint64_t identifier() const;
+    WEBCORE_EXPORT IDBConnectionIdentifier identifier() const;
 
     IDBConnectionProxy& proxy();
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -27,6 +27,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBResourceIdentifier.h"
 #include <wtf/WeakPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -37,7 +38,6 @@
 class IDBKeyData;
 class IDBObjectStoreInfo;
 class IDBRequestData;
-class IDBResourceIdentifier;
 class IDBTransactionInfo;
 class IDBValue;
 
@@ -58,7 +58,7 @@
 public:
     virtual ~IDBConnectionToServerDelegate() = default;
 
-    virtual uint64_t identifier() const = 0;
+    virtual IDBConnectionIdentifier identifier() const = 0;
     virtual void deleteDatabase(const IDBRequestData&) = 0;
     virtual void openDatabase(const IDBRequestData&) = 0;
     virtual void abortTransaction(const IDBResourceIdentifier&) = 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -43,7 +43,7 @@
 {
 }
 
-uint64_t IDBConnectionToClient::identifier() const
+IDBConnectionIdentifier IDBConnectionToClient::identifier() const
 {
     ASSERT(m_delegate);
     return m_delegate->identifier();

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -47,8 +47,7 @@
 public:
     WEBCORE_EXPORT static Ref<IDBConnectionToClient> create(IDBConnectionToClientDelegate&);
 
-    // FIXME: Use a typed identifier.
-    uint64_t identifier() const;
+    IDBConnectionIdentifier identifier() const;
 
     void didDeleteDatabase(const IDBResultData&);
     void didOpenDatabase(const IDBResultData&);

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -27,6 +27,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBResourceIdentifier.h"
 #include <wtf/Forward.h>
 #include <wtf/WeakPtr.h>
 #include <wtf/text/WTFString.h>
@@ -34,7 +35,6 @@
 namespace WebCore {
 
 class IDBError;
-class IDBResourceIdentifier;
 class IDBResultData;
 
 namespace IDBServer {
@@ -45,7 +45,7 @@
 public:
     virtual ~IDBConnectionToClientDelegate() = default;
     
-    virtual uint64_t identifier() const = 0;
+    virtual IDBConnectionIdentifier identifier() const = 0;
 
     virtual void didDeleteDatabase(const IDBResultData&) = 0;
     virtual void didOpenDatabase(const IDBResultData&) = 0;

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


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -460,12 +460,12 @@
         databaseConnection->confirmDidCloseFromServer();
 }
 
-void IDBServer::getAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
+void IDBServer::getAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
 {
     postDatabaseTask(createCrossThreadTask(*this, &IDBServer::performGetAllDatabaseNames, serverConnectionIdentifier, mainFrameOrigin, openingOrigin, callbackID));
 }
 
-void IDBServer::performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
+void IDBServer::performGetAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
 {
     auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
     String oldDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(mainFrameOrigin, openingOrigin, databaseDirectoryPath, "v0");
@@ -487,7 +487,7 @@
     postDatabaseTaskReply(createCrossThreadTask(*this, &IDBServer::didGetAllDatabaseNames, serverConnectionIdentifier, callbackID, databases));
 }
 
-void IDBServer::didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames)
+void IDBServer::didGetAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames)
 {
     auto connection = m_connectionMap.get(serverConnectionIdentifier);
     if (!connection)

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


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -96,7 +96,7 @@
     WEBCORE_EXPORT void openDBRequestCancelled(const IDBRequestData&);
     WEBCORE_EXPORT void confirmDidCloseFromServer(uint64_t databaseConnectionIdentifier);
 
-    WEBCORE_EXPORT void getAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
+    WEBCORE_EXPORT void getAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
 
     void postDatabaseTask(CrossThreadTask&&);
     void postDatabaseTaskReply(CrossThreadTask&&);
@@ -133,8 +133,8 @@
     
     String databaseDirectoryPathIsolatedCopy() const { return m_databaseDirectoryPath.isolatedCopy(); }
 
-    void performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
-    void didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
+    void performGetAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
+    void didGetAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
 
     void performCloseAndDeleteDatabasesModifiedSince(WallTime, uint64_t callbackID);
     void performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
@@ -185,7 +185,7 @@
     void finishComputingSpaceUsedForOrigin(const ClientOrigin&, uint64_t spaceUsed);
 
     PAL::SessionID m_sessionID;
-    HashMap<uint64_t, RefPtr<IDBConnectionToClient>> m_connectionMap;
+    HashMap<IDBConnectionIdentifier, RefPtr<IDBConnectionToClient>> m_connectionMap;
     HashMap<IDBDatabaseIdentifier, std::unique_ptr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap;
 
     HashMap<uint64_t, UniqueIDBDatabaseConnection*> m_databaseConnections;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -109,7 +109,7 @@
         destination.m_cursorIdentifier = makeUnique<IDBResourceIdentifier>(*source.m_cursorIdentifier);
 }
 
-uint64_t IDBRequestData::serverConnectionIdentifier() const
+IDBConnectionIdentifier IDBRequestData::serverConnectionIdentifier() const
 {
     ASSERT(m_serverConnectionIdentifier);
     return m_serverConnectionIdentifier;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -57,7 +57,7 @@
     IDBRequestData(const IDBRequestData&, IsolatedCopyTag);
     IDBRequestData isolatedCopy() const;
 
-    uint64_t serverConnectionIdentifier() const;
+    IDBConnectionIdentifier serverConnectionIdentifier() const;
     IDBResourceIdentifier requestIdentifier() const;
     IDBResourceIdentifier transactionIdentifier() const;
     uint64_t objectStoreIdentifier() const;
@@ -81,7 +81,7 @@
 private:
     static void isolatedCopy(const IDBRequestData& source, IDBRequestData& destination);
 
-    uint64_t m_serverConnectionIdentifier { 0 };
+    IDBConnectionIdentifier m_serverConnectionIdentifier;
     std::unique_ptr<IDBResourceIdentifier> m_requestIdentifier;
     std::unique_ptr<IDBResourceIdentifier> m_transactionIdentifier;
     std::unique_ptr<IDBResourceIdentifier> m_cursorIdentifier;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -53,7 +53,7 @@
 {
 }
 
-IDBResourceIdentifier::IDBResourceIdentifier(uint64_t connectionIdentifier, uint64_t resourceIdentifier)
+IDBResourceIdentifier::IDBResourceIdentifier(IDBConnectionIdentifier connectionIdentifier, uint64_t resourceIdentifier)
     : m_idbConnectionIdentifier(connectionIdentifier)
     , m_resourceNumber(resourceIdentifier)
 {
@@ -84,18 +84,17 @@
 
 IDBResourceIdentifier IDBResourceIdentifier::emptyValue()
 {
-    return IDBResourceIdentifier(0, 0);
+    return IDBResourceIdentifier({ }, 0);
 }
 
 IDBResourceIdentifier IDBResourceIdentifier::deletedValue()
 {
-    return IDBResourceIdentifier(std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::max());
+    return IDBResourceIdentifier(IDBConnectionIdentifier { WTF::HashTableDeletedValue }, std::numeric_limits<uint64_t>::max());
 }
 
 bool IDBResourceIdentifier::isHashTableDeletedValue() const
 {
-    return m_idbConnectionIdentifier == std::numeric_limits<uint64_t>::max()
-        && m_resourceNumber == std::numeric_limits<uint64_t>::max();
+    return m_idbConnectionIdentifier.isHashTableDeletedValue() && m_resourceNumber == std::numeric_limits<uint64_t>::max();
 }
 
 #if !LOG_DISABLED
@@ -102,7 +101,7 @@
 
 String IDBResourceIdentifier::loggingString() const
 {
-    return makeString('<', m_idbConnectionIdentifier, ", ", m_resourceNumber, '>');
+    return makeString('<', m_idbConnectionIdentifier.toUInt64(), ", ", m_resourceNumber, '>');
 }
 
 #endif

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h (249802 => 249803)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -27,6 +27,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "ProcessIdentifier.h"
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
@@ -41,6 +42,8 @@
 class IDBConnectionToClient;
 }
 
+using IDBConnectionIdentifier = ProcessIdentifier;
+
 class IDBResourceIdentifier {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -59,7 +62,7 @@
 
     unsigned hash() const
     {
-        uint64_t hashCodes[2] = { m_idbConnectionIdentifier, m_resourceNumber };
+        uint64_t hashCodes[2] = { m_idbConnectionIdentifier.toUInt64(), m_resourceNumber };
         return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
     }
     
@@ -69,7 +72,7 @@
             && m_resourceNumber == other.m_resourceNumber;
     }
     
-    uint64_t connectionIdentifier() const { return m_idbConnectionIdentifier; }
+    IDBConnectionIdentifier connectionIdentifier() const { return m_idbConnectionIdentifier; }
 
     IDBResourceIdentifier isolatedCopy() const;
 
@@ -83,8 +86,8 @@
     template<class Decoder> static bool decode(Decoder&, IDBResourceIdentifier&);
 
 private:
-    IDBResourceIdentifier(uint64_t connectionIdentifier, uint64_t resourceIdentifier);
-    uint64_t m_idbConnectionIdentifier { 0 };
+    IDBResourceIdentifier(IDBConnectionIdentifier, uint64_t resourceIdentifier);
+    IDBConnectionIdentifier m_idbConnectionIdentifier;
     uint64_t m_resourceNumber { 0 };
 };
 
@@ -146,6 +149,11 @@
     typedef WebCore::IDBResourceIdentifierHash Hash;
 };
 
+inline WebCore::IDBConnectionIdentifier crossThreadCopy(WebCore::IDBConnectionIdentifier identifier)
+{
+    return identifier;
+}
+
 } // namespace WTF
 
 #endif // ENABLE(INDEXED_DATABASE)

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


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -39,6 +39,7 @@
 #include "IDBResultData.h"
 #include "IDBValue.h"
 #include "Logging.h"
+#include "ProcessIdentifier.h"
 #include <wtf/FileSystem.h>
 #include <wtf/RunLoop.h>
 
@@ -90,11 +91,11 @@
     m_connectionToClient = IDBServer::IDBConnectionToClient::create(*this);
 }
 
-uint64_t InProcessIDBServer::identifier() const
+IDBConnectionIdentifier InProcessIDBServer::identifier() const
 {
     // An instance of InProcessIDBServer always has a 1:1 relationship with its instance of IDBServer.
     // Therefore the connection identifier between the two can always be "1".
-    return 1;
+    return Process::identifier();
 }
 
 IDBClient::IDBConnectionToServer& InProcessIDBServer::connectionToServer() const

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


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -95,7 +95,7 @@
     void getAllDatabaseNames(const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID) final;
 
     // IDBConnectionToClient
-    uint64_t identifier() const override;
+    IDBConnectionIdentifier identifier() const final;
     void didDeleteDatabase(const IDBResultData&) final;
     void didOpenDatabase(const IDBResultData&) final;
     void didAbortTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) final;

Modified: trunk/Source/WebKit/ChangeLog (249802 => 249803)


--- trunk/Source/WebKit/ChangeLog	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebKit/ChangeLog	2019-09-12 08:47:31 UTC (rev 249803)
@@ -1,3 +1,17 @@
+2019-09-12  Youenn Fablet  <you...@apple.com>
+
+        Use typed identifiers for IDB connection identifiers
+        https://bugs.webkit.org/show_bug.cgi?id=201682
+
+        Reviewed by Chris Dumez.
+
+        Remove no longer needed conversion from process identifier to idb connection identifier.
+
+        * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
+        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+        (WebKit::WebIDBConnectionToServer::identifier const):
+        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
+
 2019-09-12  Charlie Turner  <ctur...@igalia.com>
 
         [GTK] Allow CacheStore::destroyEngine to destroy default engine for soup.

Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h (249802 => 249803)


--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -56,12 +56,12 @@
 
 class WebIDBConnectionToClient final : public WebCore::IDBServer::IDBConnectionToClientDelegate, public IPC::MessageSender, public RefCounted<WebIDBConnectionToClient> {
 public:
-    static Ref<WebIDBConnectionToClient> create(NetworkProcess&, IPC::Connection&, WebCore::ProcessIdentifier, PAL::SessionID);
+    static Ref<WebIDBConnectionToClient> create(NetworkProcess&, IPC::Connection&, WebCore::IDBConnectionIdentifier, PAL::SessionID);
 
     virtual ~WebIDBConnectionToClient();
 
     WebCore::IDBServer::IDBConnectionToClient& connectionToClient();
-    uint64_t identifier() const final { return m_identifier.toUInt64(); }
+    WebCore::IDBConnectionIdentifier identifier() const final { return m_identifier; }
 
     void ref() override { RefCounted<WebIDBConnectionToClient>::ref(); }
     void deref() override { RefCounted<WebIDBConnectionToClient>::deref(); }
@@ -138,7 +138,7 @@
     Ref<IPC::Connection> m_connection;
     Ref<NetworkProcess> m_networkProcess;
 
-    WebCore::ProcessIdentifier m_identifier;
+    WebCore::IDBConnectionIdentifier m_identifier;
     PAL::SessionID m_sessionID;
     RefPtr<WebCore::IDBServer::IDBConnectionToClient> m_connectionToClient;
 };

Modified: trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (249802 => 249803)


--- trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp	2019-09-12 08:47:31 UTC (rev 249803)
@@ -69,9 +69,9 @@
 {
 }
 
-uint64_t WebIDBConnectionToServer::identifier() const
+IDBConnectionIdentifier WebIDBConnectionToServer::identifier() const
 {
-    return Process::identifier().toUInt64();
+    return Process::identifier();
 }
 
 IPC::Connection* WebIDBConnectionToServer::messageSenderConnection() const

Modified: trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h (249802 => 249803)


--- trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h	2019-09-12 08:44:09 UTC (rev 249802)
+++ trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h	2019-09-12 08:47:31 UTC (rev 249803)
@@ -43,7 +43,7 @@
     virtual ~WebIDBConnectionToServer();
 
     WebCore::IDBClient::IDBConnectionToServer& coreConnectionToServer();
-    uint64_t identifier() const final;
+    WebCore::IDBConnectionIdentifier identifier() const final;
 
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
     void connectionToServerLost();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to