Changeset 283504 in webkit
- Timestamp:
- Oct 4, 2021, 10:38:45 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 16 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/NetworkProcess.cpp (modified) (2 diffs)
-
NetworkProcess/NetworkProcess.h (modified) (2 diffs)
-
NetworkProcess/NetworkProcess.messages.in (modified) (1 diff)
-
NetworkProcess/NetworkProcessCreationParameters.cpp (modified) (2 diffs)
-
NetworkProcess/NetworkProcessCreationParameters.h (modified) (1 diff)
-
NetworkProcess/NetworkSession.cpp (modified) (2 diffs)
-
NetworkProcess/NetworkSession.h (modified) (2 diffs)
-
NetworkProcess/NetworkSessionCreationParameters.cpp (modified) (3 diffs)
-
NetworkProcess/NetworkSessionCreationParameters.h (modified) (1 diff)
-
NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp (modified) (1 diff)
-
UIProcess/Cocoa/WebProcessPoolCocoa.mm (modified) (1 diff)
-
UIProcess/Network/NetworkProcessProxy.cpp (modified) (1 diff)
-
UIProcess/Network/NetworkProcessProxy.h (modified) (1 diff)
-
UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (modified) (3 diffs)
-
UIProcess/WebsiteData/WebsiteDataStore.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r283490 r283504 1 2021-10-04 Alex Christensen <achristensen@webkit.org> 2 3 Enable PCM debug mode per WebsiteDataStore instead of process-global 4 https://bugs.webkit.org/show_bug.cgi?id=231096 5 6 Reviewed by Kate Cheney. 7 8 This will make it so we don't need to restart the network process in order to enable or disable debug mode. 9 10 * NetworkProcess/NetworkProcess.cpp: 11 (WebKit::NetworkProcess::initializeNetworkProcess): 12 (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): 13 (WebKit::NetworkProcess::privateClickMeasurementDebugModeEnabled const): Deleted. 14 * NetworkProcess/NetworkProcess.h: 15 * NetworkProcess/NetworkProcess.messages.in: 16 * NetworkProcess/NetworkProcessCreationParameters.cpp: 17 (WebKit::NetworkProcessCreationParameters::encode const): 18 (WebKit::NetworkProcessCreationParameters::decode): 19 * NetworkProcess/NetworkProcessCreationParameters.h: 20 * NetworkProcess/NetworkSession.cpp: 21 (WebKit::NetworkSession::NetworkSession): 22 (WebKit::NetworkSession::setPrivateClickMeasurementDebugMode): 23 * NetworkProcess/NetworkSession.h: 24 (WebKit::NetworkSession::privateClickMeasurementDebugModeEnabled const): 25 * NetworkProcess/NetworkSessionCreationParameters.cpp: 26 (WebKit::NetworkSessionCreationParameters::encode const): 27 (WebKit::NetworkSessionCreationParameters::decode): 28 * NetworkProcess/NetworkSessionCreationParameters.h: 29 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp: 30 (WebKit::PCM::ClientImpl::debugModeEnabled const): 31 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 32 (WebKit::WebProcessPool::platformInitializeNetworkProcess): 33 * UIProcess/Network/NetworkProcessProxy.cpp: 34 (WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode): 35 * UIProcess/Network/NetworkProcessProxy.h: 36 * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: 37 (WebKit::experimentalFeatureEnabled): 38 (WebKit::WebsiteDataStore::platformSetNetworkParameters): 39 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 40 (WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode): 41 1 42 2021-10-04 Jean-Yves Avenard <jya@apple.com> 2 43 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r283316 r283504 347 347 348 348 setPrivateClickMeasurementEnabled(parameters.enablePrivateClickMeasurement); 349 setPrivateClickMeasurementDebugMode(parameters.enablePrivateClickMeasurementDebugMode);350 349 m_ftpEnabled = parameters.ftpEnabled; 351 350 … … 1353 1352 } 1354 1353 1355 void NetworkProcess::setPrivateClickMeasurementDebugMode(bool enabled) 1356 { 1357 if (m_privateClickMeasurementDebugModeEnabled == enabled) 1358 return; 1359 1360 m_privateClickMeasurementDebugModeEnabled = enabled; 1361 1362 String message = enabled ? "[Private Click Measurement] Turned Debug Mode on."_s : "[Private Click Measurement] Turned Debug Mode off."_s; 1363 for (auto& networkConnectionToWebProcess : m_webProcessConnections.values()) { 1364 if (networkConnectionToWebProcess->sessionID().isEphemeral()) 1365 continue; 1366 networkConnectionToWebProcess->broadcastConsoleMessage(MessageSource::PrivateClickMeasurement, MessageLevel::Info, message); 1367 } 1368 } 1369 1370 bool NetworkProcess::privateClickMeasurementDebugModeEnabled() const 1371 { 1372 return m_privateClickMeasurementDebugModeEnabled; 1354 void NetworkProcess::setPrivateClickMeasurementDebugMode(PAL::SessionID sessionID, bool enabled) 1355 { 1356 if (auto* networkSession = this->networkSession(sessionID)) 1357 networkSession->setPrivateClickMeasurementDebugMode(enabled); 1373 1358 } 1374 1359 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r283316 r283504 286 286 void setPrivateClickMeasurementEnabled(bool); 287 287 bool privateClickMeasurementEnabled() const; 288 void setPrivateClickMeasurementDebugMode(bool); 289 bool privateClickMeasurementDebugModeEnabled() const; 288 void setPrivateClickMeasurementDebugMode(PAL::SessionID, bool); 290 289 291 290 using CacheStorageRootPathCallback = CompletionHandler<void(String&&)>; … … 621 620 622 621 bool m_privateClickMeasurementEnabled { true }; 623 bool m_privateClickMeasurementDebugModeEnabled { false };624 622 bool m_ftpEnabled { false }; 625 623 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r283316 r283504 147 147 #endif 148 148 149 SetPrivateClickMeasurementDebugMode( bool debugMode)149 SetPrivateClickMeasurementDebugMode(PAL::SessionID sessionID, bool debugMode) 150 150 151 151 SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled); -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
r282881 r283504 72 72 73 73 encoder << enablePrivateClickMeasurement; 74 encoder << enablePrivateClickMeasurementDebugMode;75 74 encoder << ftpEnabled; 76 75 encoder << websiteDataStoreParameters; … … 146 145 if (!decoder.decode(result.enablePrivateClickMeasurement)) 147 146 return false; 148 if (!decoder.decode(result.enablePrivateClickMeasurementDebugMode))149 return false;150 147 if (!decoder.decode(result.ftpEnabled)) 151 148 return false; -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
r282881 r283504 88 88 89 89 bool enablePrivateClickMeasurement { true }; 90 bool enablePrivateClickMeasurementDebugMode { false };91 90 bool ftpEnabled { false }; 92 91 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r283383 r283504 118 118 #endif 119 119 , m_privateClickMeasurement(managerOrProxy(*this, networkProcess, parameters)) 120 , m_privateClickMeasurementDebugModeEnabled(parameters.enablePrivateClickMeasurementDebugMode) 120 121 , m_broadcastChannelRegistry(makeUniqueRef<NetworkBroadcastChannelRegistry>()) 121 122 , m_testSpeedMultiplier(parameters.testSpeedMultiplier) … … 421 422 } 422 423 424 void NetworkSession::setPrivateClickMeasurementDebugMode(bool enabled) 425 { 426 if (m_privateClickMeasurementDebugModeEnabled == enabled) 427 return; 428 429 m_privateClickMeasurementDebugModeEnabled = enabled; 430 431 auto message = enabled ? "[Private Click Measurement] Turned Debug Mode on."_s : "[Private Click Measurement] Turned Debug Mode off."_s; 432 m_networkProcess->broadcastConsoleMessage(sessionID(), MessageSource::PrivateClickMeasurement, MessageLevel::Info, message); 433 } 434 423 435 void NetworkSession::firePrivateClickMeasurementTimerImmediatelyForTesting() 424 436 { -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r283383 r283504 176 176 NetworkLoadScheduler& networkLoadScheduler(); 177 177 PCM::ManagerInterface& privateClickMeasurement() { return m_privateClickMeasurement.get(); } 178 void setPrivateClickMeasurementDebugMode(bool); 179 bool privateClickMeasurementDebugModeEnabled() const { return m_privateClickMeasurementDebugModeEnabled; } 178 180 179 181 #if PLATFORM(COCOA) … … 216 218 bool m_isStaleWhileRevalidateEnabled { false }; 217 219 UniqueRef<PCM::ManagerInterface> m_privateClickMeasurement; 220 bool m_privateClickMeasurementDebugModeEnabled { false }; 218 221 std::optional<WebCore::PrivateClickMeasurement> m_ephemeralMeasurement; 219 222 bool m_isRunningEphemeralMeasurementTest { false }; -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
r283295 r283504 90 90 encoder << allowsHSTSWithUntrustedRootCertificate; 91 91 encoder << pcmMachServiceName; 92 encoder << enablePrivateClickMeasurementDebugMode; 92 93 encoder << resourceLoadStatisticsParameters; 93 94 } … … 305 306 decoder >> pcmMachServiceName; 306 307 if (!pcmMachServiceName) 308 return std::nullopt; 309 310 std::optional<bool> enablePrivateClickMeasurementDebugMode; 311 decoder >> enablePrivateClickMeasurementDebugMode; 312 if (!enablePrivateClickMeasurementDebugMode) 307 313 return std::nullopt; 308 314 … … 362 368 , WTFMove(*allowsHSTSWithUntrustedRootCertificate) 363 369 , WTFMove(*pcmMachServiceName) 370 , WTFMove(*enablePrivateClickMeasurementDebugMode) 364 371 , WTFMove(*resourceLoadStatisticsParameters) 365 372 }}; -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
r283295 r283504 105 105 bool allowsHSTSWithUntrustedRootCertificate { false }; 106 106 String pcmMachServiceName; 107 bool enablePrivateClickMeasurementDebugMode { false }; 107 108 108 109 ResourceLoadStatisticsParameters resourceLoadStatisticsParameters; -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp
r282110 r283504 56 56 { 57 57 return m_networkSession 58 && m_network Process->privateClickMeasurementDebugModeEnabled()58 && m_networkSession->privateClickMeasurementDebugModeEnabled() 59 59 && !m_networkSession->sessionID().isEphemeral(); 60 60 } -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r283457 r283504 558 558 559 559 parameters.enablePrivateClickMeasurement = ![defaults objectForKey:WebPreferencesKey::privateClickMeasurementEnabledKey()] || [defaults boolForKey:WebPreferencesKey::privateClickMeasurementEnabledKey()]; 560 #if PLATFORM(MAC)561 NSString *format = @"Experimental%@";562 #else563 NSString *format = @"WebKitExperimental%@";564 #endif565 parameters.enablePrivateClickMeasurementDebugMode = [defaults boolForKey:[NSString stringWithFormat:format, WebPreferencesKey::privateClickMeasurementDebugModeEnabledKey().createCFString().get()]];566 567 560 parameters.ftpEnabled = [defaults objectForKey:WebPreferencesKey::ftpEnabledKey()] && [defaults boolForKey:WebPreferencesKey::ftpEnabledKey()]; 568 561 } -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r283320 r283504 1256 1256 #endif // ENABLE(INTELLIGENT_TRACKING_PREVENTION) 1257 1257 1258 void NetworkProcessProxy::setPrivateClickMeasurementDebugMode( bool debugMode)1258 void NetworkProcessProxy::setPrivateClickMeasurementDebugMode(PAL::SessionID sessionID, bool debugMode) 1259 1259 { 1260 1260 if (!canSendMessage()) 1261 1261 return; 1262 1262 1263 send(Messages::NetworkProcess::SetPrivateClickMeasurementDebugMode( debugMode), 0);1263 send(Messages::NetworkProcess::SetPrivateClickMeasurementDebugMode(sessionID, debugMode), 0); 1264 1264 } 1265 1265 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r283320 r283504 206 206 #endif 207 207 208 void setPrivateClickMeasurementDebugMode( bool);208 void setPrivateClickMeasurementDebugMode(PAL::SessionID, bool); 209 209 210 210 void synthesizeAppIsBackground(bool background); -
trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
r283374 r283504 93 93 #endif 94 94 95 static bool experimentalFeatureEnabled(const String& key) 96 { 97 #if PLATFORM(MAC) 98 NSString *format = @"Experimental%@"; 99 #else 100 NSString *format = @"WebKitExperimental%@"; 101 #endif 102 return [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:format, static_cast<NSString *>(key)]]; 103 } 104 95 105 void WebsiteDataStore::platformSetNetworkParameters(WebsiteDataStoreParameters& parameters) 96 106 { … … 193 203 parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier; 194 204 205 parameters.networkSessionParameters.enablePrivateClickMeasurementDebugMode = experimentalFeatureEnabled(WebPreferencesKey::privateClickMeasurementDebugModeEnabledKey()); 206 195 207 if (!cookieFile.isEmpty()) { 196 208 if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(FileSystem::parentPath(cookieFile))) … … 198 210 } 199 211 } 200 201 #if HAVE(CFNETWORK_ALTERNATIVE_SERVICE) || HAVE(NETWORK_LOADER)202 static bool experimentalFeatureEnabled(const String& key)203 {204 #if PLATFORM(MAC)205 NSString *format = @"Experimental%@";206 #else207 NSString *format = @"WebKitExperimental%@";208 #endif209 return [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:format, static_cast<NSString *>(key)]];210 }211 #endif212 212 213 213 bool WebsiteDataStore::http3Enabled() -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r283295 r283504 1905 1905 void WebsiteDataStore::setPrivateClickMeasurementDebugMode(bool enabled) 1906 1906 { 1907 networkProcess().setPrivateClickMeasurementDebugMode( enabled);1907 networkProcess().setPrivateClickMeasurementDebugMode(sessionID(), enabled); 1908 1908 } 1909 1909
Note:
See TracChangeset
for help on using the changeset viewer.