Add "Identified" base class to replace a whole bunch of custom identifier generators.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 21:50:27 +0000 (21:50 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 21:50:27 +0000 (21:50 +0000)
commitff79b69b892323b70650fa6e76c64697083318e5
treef06c2f997934a6cb0ffc90282a120f20c24bf21d
parent9dddae16d22c926fd916e76e804f9e3e514bc11d
Add "Identified" base class to replace a whole bunch of custom identifier generators.
https://bugs.webkit.org/show_bug.cgi?id=176120

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No behavior change).

Instead of repeating the common pattern of a class with an integer identifier keeping its
own static counter of the next identifier and generating it for each instance, this
uses a common template in WTF that does that automatically.

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::confirmDidCloseFromServer):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didFireVersionChangeEvent):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didFinishHandlingVersionChange):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
(WebCore::IDBServer::nextDatabaseConnectionIdentifier): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::identifier const): Deleted.

* workers/service/ServiceWorkerJobData.cpp:
(WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
(WebCore::ServiceWorkerJobData::isolatedCopy const):
* workers/service/ServiceWorkerJobData.h:
(WebCore::ServiceWorkerJobData::encode const):
(WebCore::ServiceWorkerJobData::decode):
(WebCore::ServiceWorkerJobData::identifier const): Deleted.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::Connection):
* workers/service/server/SWServer.h:
(WebCore::SWServer::Connection::identifier const): Deleted.

* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::SWServerRegistration):
(WebCore::SWServerRegistration::data const):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::identifier const): Deleted.

Source/WebKit:

* UIProcess/API/APIUserScript.cpp:
(API::UserScript::UserScript):
(API::generateIdentifier): Deleted.
* UIProcess/API/APIUserScript.h:

* UIProcess/API/APIUserStyleSheet.cpp:
(API::UserStyleSheet::UserStyleSheet):
(API::generateIdentifier): Deleted.
* UIProcess/API/APIUserStyleSheet.h:

* UIProcess/UserContent/WebScriptMessageHandler.cpp:
(WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
(WebKit::generateIdentifier): Deleted.
* UIProcess/UserContent/WebScriptMessageHandler.h:
(WebKit::WebScriptMessageHandler::identifier const): Deleted.

* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::removeProcess):
(WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
(WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
(WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
(WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
(WebKit::WebUserContentControllerProxy::addContentRuleList):
(WebKit::WebUserContentControllerProxy::removeContentRuleList):
(WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
(WebKit::generateIdentifier): Deleted.
* UIProcess/UserContent/WebUserContentControllerProxy.h:
(WebKit::WebUserContentControllerProxy::identifier const): Deleted.

* UIProcess/VisitedLinkStore.cpp:
(WebKit::VisitedLinkStore::~VisitedLinkStore):
(WebKit::VisitedLinkStore::VisitedLinkStore):
(WebKit::VisitedLinkStore::addProcess):
(WebKit::VisitedLinkStore::removeProcess):
(WebKit::VisitedLinkStore::removeAll):
(WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
(WebKit::VisitedLinkStore::sendTable):
(WebKit::generateIdentifier): Deleted.
* UIProcess/VisitedLinkStore.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
(WebKit::generateIdentifier): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::identifier const): Deleted.

* WebProcess/Network/WebSocketStream.cpp:
(WebKit::WebSocketStream::WebSocketStream):
(WebKit::WebSocketStream::~WebSocketStream):
(WebKit::WebSocketStream::messageSenderDestinationID):
* WebProcess/Network/WebSocketStream.h:

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/Identified.h: Added.
(WTF::IdentifiedBase::identifier const):
(WTF::IdentifiedBase::IdentifiedBase):
(WTF::Identified::Identified):
(WTF::ThreadSafeIdentified::ThreadSafeIdentified):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/Identified.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h
Source/WebCore/workers/service/ServiceWorkerJobData.cpp
Source/WebCore/workers/service/ServiceWorkerJobData.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerRegistration.cpp
Source/WebCore/workers/service/server/SWServerRegistration.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIUserScript.cpp
Source/WebKit/UIProcess/API/APIUserScript.h
Source/WebKit/UIProcess/API/APIUserStyleSheet.cpp
Source/WebKit/UIProcess/API/APIUserStyleSheet.h
Source/WebKit/UIProcess/UserContent/WebScriptMessageHandler.cpp
Source/WebKit/UIProcess/UserContent/WebScriptMessageHandler.h
Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp
Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.h
Source/WebKit/UIProcess/VisitedLinkStore.cpp
Source/WebKit/UIProcess/VisitedLinkStore.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebProcess/Network/WebSocketStream.cpp
Source/WebKit/WebProcess/Network/WebSocketStream.h