source: webkit/trunk/Source/WebKit/UIProcess/WebPageGroup.cpp

Last change on this file was 292197, checked in by Chris Dumez, 3 years ago

Prepare WebKit/ & WebKitLegacy/ for making the String(const char*) constructor explicit
https://bugs.webkit.org/show_bug.cgi?id=238525

Reviewed by Darin Adler.

Source/WebCore:

  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):

  • Modules/model-element/scenekit/SceneKitModelLoaderUSD.mm:

(WebCore::writeToTemporaryFile):

  • Modules/webdatabase/Database.cpp:

(WebCore::Database::performOpenAndVerify):

  • Modules/webdatabase/DatabaseTracker.cpp:

(WebCore::DatabaseTracker::trackerDatabasePath const):
(WebCore::DatabaseTracker::openTrackerDatabase):

  • bindings/js/GCController.cpp:

(WebCore::GCController::dumpHeap):

  • contentextensions/SerializedNFA.cpp:

(WebCore::ContentExtensions::SerializedNFA::serialize):

  • contentextensions/URLFilterParser.cpp:

(WebCore::ContentExtensions::URLFilterParser::addPattern):

  • contentextensions/URLFilterParser.h:
  • loader/ResourceLoadStatistics.cpp:

(WebCore::appendBoolean):

  • page/SecurityOriginData.cpp:

(WebCore::SecurityOriginData::fromDatabaseIdentifier):

  • page/SecurityOriginData.h:
  • platform/graphics/cg/ImageUtilitiesCG.cpp:

(WebCore::transcodeImage):

  • platform/ios/PlatformEventFactoryIOS.mm:

(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

  • platform/network/BlobRegistryImpl.cpp:

(WebCore::BlobRegistryImpl::writeBlobsToTemporaryFilesForIndexedDB):

  • platform/sql/SQLiteDatabase.cpp:

(WebCore::SQLiteDatabase::tableExists):
(WebCore::SQLiteDatabase::tableSQL):
(WebCore::SQLiteDatabase::indexSQL):
(WebCore::SQLiteDatabase::inMemoryPath): Deleted.

  • platform/sql/SQLiteDatabase.h:

(WebCore::SQLiteDatabase::inMemoryPath):

  • platform/sql/SQLiteFileSystem.cpp:

(WebCore::SQLiteFileSystem::appendDatabaseFileNameToPath):
(WebCore::SQLiteFileSystem::computeHashForFileName):

  • platform/sql/SQLiteFileSystem.h:

Source/WebKit:

  • GPUProcess/graphics/RemoteGraphicsContextGL.cpp:

(WebKit::RemoteGraphicsContextGL::workQueueInitialize):

  • NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:

(WebKit::appendBoolean):
(WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement const):
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const):
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const):

  • NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):

  • NetworkProcess/NetworkDataTaskBlob.cpp:

(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::deletePushAndNotificationRegistration):

  • NetworkProcess/NetworkResourceLoader.cpp:

(WebKit::NetworkResourceLoader::logCookieInformation const):
(WebKit::logBlockedCookieInformation):
(WebKit::logCookieInformationInternal):
(WebKit::NetworkResourceLoader::logCookieInformation):

  • NetworkProcess/NetworkResourceLoader.h:
  • NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:

(WebKit::PCM::Database::clearPrivateClickMeasurement):
(WebKit::PCM::Database::addDestinationTokenColumnsIfNecessary):
(WebKit::PCM::Database::columnsForTable):
(WebKit::PCM::Database::addMissingColumnToTable):

  • NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
  • NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:

(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableTokenForDestination):
(WebKit::PrivateClickMeasurementManager::handleAttribution):

  • NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:

(WebKit::LocalStorageDatabaseTracker::databasePath const):

  • NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
  • NetworkProcess/cache/NetworkCacheBlobStorage.cpp:

(WebKit::NetworkCache::BlobStorage::get):

  • NetworkProcess/cache/NetworkCacheData.cpp:

(WebKit::NetworkCache::mapFile):

  • NetworkProcess/cache/NetworkCacheData.h:
  • NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:

(WebKit::LaunchServicesDatabaseObserver::handleEvent):

  • NetworkProcess/storage/SQLiteStorageArea.cpp:

(WebKit::SQLiteStorageArea::createTableIfNecessary):

  • Platform/IPC/JSIPCBinding.cpp:

(IPC::jsValueForDecodedArgumentValue):

  • Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
  • Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
  • Shared/API/Cocoa/WKRemoteObjectCoder.mm:

(encodeObject):

  • Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:

(-[_WKRemoteObjectRegistry _sendInvocation:interface:]):
(replyBlockSignature):
(-[_WKRemoteObjectRegistry _invokeMethod:]):

  • Shared/Cocoa/SandboxExtensionCocoa.mm:

(WebKit::stringByResolvingSymlinksInPath):
(WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
(WebKit::resolvePathForSandboxExtension):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandle):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForTemporaryFile):
(WebKit::SandboxExtension::createHandleForReadByAuditToken):

  • Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:

(WebKit::XPCServiceInitializerDelegate::getClientIdentifier):
(WebKit::XPCServiceInitializerDelegate::getClientBundleIdentifier):
(WebKit::XPCServiceInitializerDelegate::getClientProcessName):
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):

  • Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:

(WebKit::XPCServiceMain):

  • Shared/IPCTester.cpp:

(WebKit::messageTestDriver):

  • Shared/InspectorExtensionTypes.cpp:

(Inspector::extensionErrorToString):

  • Shared/SandboxExtension.h:

(WebKit::SandboxExtension::createHandle):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForTemporaryFile):
(WebKit::stringByResolvingSymlinksInPath):
(WebKit::resolvePathForSandboxExtension):
(WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):

  • Shared/mac/AuxiliaryProcessMac.mm:

(WebKit::sandboxDataVaultParentDirectory):
(WebKit::getUserDirectorySuffix):
(WebKit::populateSandboxInitializationParameters):

  • Shared/mac/WebEventFactory.mm:

(WebKit::WebEventFactory::createWebKeyboardEvent):

  • UIProcess/API/APIContentRuleListStore.cpp:

(API::openAndMapContentRuleList):

  • UIProcess/API/C/WKDownloadRef.cpp:

(WKDownloadSetClient):

  • UIProcess/API/C/WKPage.cpp:

(WKPageGetSessionHistoryURLValueType):
(WKPageGetSessionBackForwardListItemValueType):
(WKPageSetPageUIClient):

  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesCreate):
(WKPreferencesCreateWithIdentifier):

  • UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:

(API::ContentRuleListStore::defaultStorePath):

  • UIProcess/API/Cocoa/WKContentRuleListStore.mm:

(+[WKContentRuleListStore storeWithURL:]):
(+[WKContentRuleListStore storeWithURLAndLegacyFilename:]):

  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences init]):

  • UIProcess/AuxiliaryProcessProxy.cpp:

(WebKit::AuxiliaryProcessProxy::getLaunchOptions):

  • UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:

(WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame):

  • UIProcess/Cocoa/WebKitSwiftSoftLink.mm:

(WebKit::WebKitSwiftLibrary):

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):

  • UIProcess/Cocoa/WebViewImpl.mm:

(-[WKTextTouchBarItemController _wkChangeTextStyle:]):
(-[WKTextTouchBarItemController _wkChangeTextAlignment:]):
(-[WKTextTouchBarItemController _wkChangeColor:]):
(WebKit::WebViewImpl::insertText):

  • UIProcess/DeviceIdHashSaltStorage.cpp:

(WebKit::getSecurityOriginData):
(WebKit::DeviceIdHashSaltStorage::getDataFromDecoder const):
(WebKit::DeviceIdHashSaltStorage::createEncoderFromData const):

  • UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:

(WebKit::ProcessLauncher::launchProcess):

  • UIProcess/Network/NetworkProcessProxyCocoa.mm:

(WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const):

  • UIProcess/UserMediaPermissionRequestManagerProxy.cpp:

(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):

  • UIProcess/ViewGestureController.cpp:

(WebKit::ViewGestureController::SnapshotRemovalTracker::log const):
(WebKit::ViewGestureController::SnapshotRemovalTracker::reset):
(WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
(WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred):
(WebKit::ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent):
(WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible):
(WebKit::stopWaitingForEvent): Deleted.

  • UIProcess/ViewGestureController.h:
  • UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
  • UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorUtils.mm:

(WebKit::base64PrivateKey):

  • UIProcess/WebAuthentication/Virtual/VirtualHidConnection.cpp:

(WebKit::VirtualHidConnection::parseRequest):

  • UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:

(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):

  • UIProcess/WebPageGroup.cpp:

(WebKit::WebPageGroup::WebPageGroup):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition):

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::didReceiveInvalidMessage):

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed):
(WebKit::WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
(WebKit::WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
(WebKit::WebProcessProxy::createSpeechRecognitionServer):

  • UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:

(WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
(WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
(WebKit::WebsiteDataStore::defaultAlternativeServicesDirectory):
(WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
(WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
(WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
(WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
(WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
(WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
(WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
(WebKit::WebsiteDataStore::defaultModelElementCacheDirectory):
(WebKit::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):

  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::fetchDataAndApply):

  • WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:

(WebKit::formatNameFromWebRTCCodecType):

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageSetComposition):

  • WebProcess/Network/WebSocketChannel.cpp:

(WebKit::WebSocketChannel::increaseBufferedAmount):

  • WebProcess/Network/WebSocketStream.cpp:

(WebKit::WebSocketStream::networkProcessCrashed):

  • WebProcess/Plugins/PDF/PDFPlugin.mm:

(WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel):
(WebKit::PDFPlugin::threadEntry):
(WebKit::PDFPlugin::adoptBackgroundThreadDocument):
(WebKit::PDFPlugin::pluginInfo):
(WebKit::PDFPlugin::addArchiveResource):
(WebKit::PDFPlugin::setSuggestedFilename):
(WebKit::PDFPlugin::initialize):

  • WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:

(WebKit::cssAlignmentValueForNSTextAlignment):

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::loadURL):

  • WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:

(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):

  • WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp:

(WebKit::WebFileSystemStorageConnection::isSameEntry):
(WebKit::WebFileSystemStorageConnection::getFileHandle):
(WebKit::WebFileSystemStorageConnection::getDirectoryHandle):
(WebKit::WebFileSystemStorageConnection::removeEntry):
(WebKit::WebFileSystemStorageConnection::resolve):
(WebKit::WebFileSystemStorageConnection::getFile):
(WebKit::WebFileSystemStorageConnection::createSyncAccessHandle):
(WebKit::WebFileSystemStorageConnection::closeSyncAccessHandle):
(WebKit::WebFileSystemStorageConnection::getHandleNames):
(WebKit::WebFileSystemStorageConnection::getHandle):
(WebKit::WebFileSystemStorageConnection::move):

  • WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:

(WebKit::WebSpeechSynthesisClient::speak):

  • WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:

(WebKit::changeWordCase):

  • WebProcess/WebPage/IPCTestingAPI.cpp:

(WebKit::IPCTestingAPI::JSMessageListener::jsDescriptionFromDecoder):
(IPC::jsValueForDecodedArgumentValue):

  • WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::layerTreeAsText const):

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::transientZoomSnapAnimationForKeyPath):
(WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):

  • WebProcess/cocoa/LaunchServicesDatabaseManager.mm:

(WebKit::LaunchServicesDatabaseManager::handleEvent):

  • webpushd/AppBundleRequest.mm:

(WebPushD::AppBundleDeletionRequest::didDeleteExistingBundleWithError):

  • webpushd/PushClientConnection.h:
  • webpushd/PushClientConnection.mm:

(WebPushD::ClientConnection::broadcastDebugMessage):
(WebPushD::ClientConnection::sendDebugMessage):

  • webpushd/WebPushDaemon.h:
  • webpushd/WebPushDaemon.mm:

(WebPushD::Daemon::broadcastDebugMessage):
(WebPushD::Daemon::deletePushAndNotificationRegistration):

  • webpushd/WebPushDaemonMain.mm:

(WebKit::WebPushDaemonMain):

Source/WebKitLegacy:

  • Storage/StorageTracker.cpp:

(WebKit::StorageTracker::tracker):

Source/WebKitLegacy/cf:

  • WebCoreSupport/WebInspectorClientCF.cpp:

(WebInspectorClient::setInspectorAttachDisabled):
(WebInspectorClient::setInspectorStartsAttached):

Source/WebKitLegacy/mac:

  • History/HistoryPropertyList.mm:

(HistoryPropertyListWriter::writeObjects):

  • WebCoreSupport/WebApplicationCache.mm:

(webApplicationCacheStorage):

  • WebCoreSupport/WebSecurityOrigin.mm:

(WebCore::SecurityOriginData::fromDatabaseIdentifier):

  • WebView/WebHTMLView.mm:

(createSelectorExceptionMap):
(-[WebHTMLView coreCommandByName:]):
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
(-[WebHTMLView _setPrinting:minimumPageLogicalWidth:logicalHeight:originalPageWidth:originalPageHeight:maximumShrinkRatio:adjustViewSize:paginateScreenContent:]):
(-[WebHTMLView insertText:]):

  • WebView/WebView.mm:

(+[WebView _decodeData:]):

Source/WTF:

  • wtf/FileSystem.h:

(WTF::FileSystemImpl::openTemporaryFile):

  • wtf/cocoa/FileSystemCocoa.mm:

(WTF::FileSystemImpl::openTemporaryFile):

  • wtf/glib/FileSystemGlib.cpp:

(WTF::FileSystemImpl::openTemporaryFile):

  • wtf/posix/FileSystemPOSIX.cpp:

(WTF::FileSystemImpl::openTemporaryFile):

  • wtf/win/FileSystemWin.cpp:

(WTF::FileSystemImpl::openTemporaryFile):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/Download.mm:

(-[BlobWithUSDZExtensionDownloadDelegate _download:decideDestinationWithSuggestedFilename:completionHandler:]):

  • TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm:

(runTest):
(createDirectories):

  • TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:

(TEST):

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1/*
2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "WebPageGroup.h"
28
29#include "APIArray.h"
30#include "APIContentRuleList.h"
31#include "APIUserScript.h"
32#include "APIUserStyleSheet.h"
33#include "WebCompiledContentRuleList.h"
34#include "WebPageProxy.h"
35#include "WebPreferences.h"
36#include "WebUserContentControllerProxy.h"
37#include <wtf/HashMap.h>
38#include <wtf/NeverDestroyed.h>
39#include <wtf/text/StringConcatenate.h>
40
41namespace WebKit {
42
43typedef HashMap<PageGroupIdentifier, WebPageGroup*> WebPageGroupMap;
44
45static WebPageGroupMap& webPageGroupMap()
46{
47 static NeverDestroyed<WebPageGroupMap> map;
48 return map;
49}
50
51Ref<WebPageGroup> WebPageGroup::create(const String& identifier)
52{
53 return adoptRef(*new WebPageGroup(identifier));
54}
55
56WebPageGroup* WebPageGroup::get(PageGroupIdentifier pageGroupID)
57{
58 return webPageGroupMap().get(pageGroupID);
59}
60
61void WebPageGroup::forEach(Function<void(WebPageGroup&)>&& function)
62{
63 auto allGroups = copyToVectorOf<RefPtr<WebPageGroup>>(webPageGroupMap().values());
64 for (auto& group : allGroups) {
65 if (group)
66 function(*group);
67 }
68}
69
70static WebPageGroupData pageGroupData(const String& identifier)
71{
72 WebPageGroupData data;
73
74 static NeverDestroyed<HashMap<String, PageGroupIdentifier>> map;
75 if (HashMap<String, PageGroupIdentifier>::isValidKey(identifier)) {
76 data.pageGroupID = map.get().ensure(identifier, [] {
77 return PageGroupIdentifier::generate();
78 }).iterator->value;
79 } else
80 data.pageGroupID = PageGroupIdentifier::generate();
81
82 if (!identifier.isEmpty())
83 data.identifier = identifier;
84 else
85 data.identifier = makeString("__uniquePageGroupID-", data.pageGroupID.toUInt64());
86
87 return data;
88}
89
90// FIXME: Why does the WebPreferences object here use ".WebKit2" instead of "WebKit2." which all the other constructors use.
91// If it turns out that it's wrong, we can change it to to "WebKit2." and get rid of the globalDebugKeyPrefix from WebPreferences.
92WebPageGroup::WebPageGroup(const String& identifier)
93 : m_data(pageGroupData(identifier))
94 , m_preferences(WebPreferences::createWithLegacyDefaults(m_data.identifier, ".WebKit2"_s, "WebKit2."_s))
95 , m_userContentController(WebUserContentControllerProxy::create())
96{
97 webPageGroupMap().set(m_data.pageGroupID, this);
98}
99
100WebPageGroup::~WebPageGroup()
101{
102 webPageGroupMap().remove(pageGroupID());
103}
104
105void WebPageGroup::addPage(WebPageProxy& page)
106{
107 m_pages.add(page);
108}
109
110void WebPageGroup::removePage(WebPageProxy& page)
111{
112 m_pages.remove(page);
113}
114
115void WebPageGroup::setPreferences(WebPreferences* preferences)
116{
117 if (preferences == m_preferences)
118 return;
119
120 m_preferences = preferences;
121
122 for (auto& webPageProxy : m_pages)
123 webPageProxy.setPreferences(*m_preferences);
124}
125
126WebPreferences& WebPageGroup::preferences() const
127{
128 return *m_preferences;
129}
130
131WebUserContentControllerProxy& WebPageGroup::userContentController()
132{
133 return m_userContentController;
134}
135
136} // namespace WebKit
Note: See TracBrowser for help on using the repository browser.