Changeset 282230 in webkit
- Timestamp:
- Sep 9, 2021, 11:25:42 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 added
- 18 edited
- 11 copied
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/spi/darwin/XPCSPI.h (modified) (7 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkSession.cpp (modified) (4 diffs)
-
WebKit/NetworkProcess/NetworkSession.h (modified) (5 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp (copied) (copied from trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h (copied) (copied from trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp (copied) (copied from trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.h (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h (modified) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp (added)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h (added)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp (added)
-
WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h (added)
-
WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm (added)
-
WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm (modified) (1 diff)
-
WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.h (copied) (copied from trunk/Source/WebKit/Shared/API/Cocoa/WKMain.mm ) (2 diffs)
-
WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm (copied) (copied from trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm ) (2 diffs)
-
WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm (modified) (1 diff)
-
WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in (modified) (1 diff)
-
WebKit/Platform/IPC/ArgumentCoder.h (modified) (3 diffs)
-
WebKit/Platform/IPC/ArgumentCoders.cpp (modified) (6 diffs)
-
WebKit/Platform/IPC/ArgumentCoders.h (modified) (7 diffs)
-
WebKit/Shared/API/Cocoa/WKMain.h (modified) (1 diff)
-
WebKit/Shared/API/Cocoa/WKMain.mm (modified) (2 diffs)
-
WebKit/Shared/EntryPointUtilities/Cocoa/Daemon (added)
-
WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.h (copied) (copied from trunk/Source/WebKit/Shared/API/Cocoa/WKMain.mm ) (2 diffs)
-
WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm (added)
-
WebKit/Sources.txt (modified) (1 diff)
-
WebKit/SourcesCocoa.txt (modified) (2 diffs)
-
WebKit/WebKit.xcodeproj/project.pbxproj (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r282221 r282230 1 2021-09-09 Alex Christensen <achristensen@webkit.org> 2 3 Add PrivateClickMeasurement daemon 4 https://bugs.webkit.org/show_bug.cgi?id=230052 5 6 Reviewed by Chris Dumez. 7 8 * wtf/spi/darwin/XPCSPI.h: 9 1 10 2021-09-09 Patrick Angle <pangle@apple.com> 2 11 -
trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h
r278716 r282230 37 37 typedef xpc_object_t xpc_connection_t; 38 38 typedef xpc_object_t xpc_endpoint_t; 39 typedef xpc_object_t xpc_activity_t; 39 40 40 41 static ALWAYS_INLINE void _xpc_object_validate(xpc_object_t object) … … 51 52 typedef void* xpc_connection_t; 52 53 typedef void* xpc_endpoint_t; 54 typedef void* xpc_activity_t; 53 55 54 56 #define XPC_GLOBAL_OBJECT(object) (&(object)) … … 56 58 #endif // OS_OBJECT_USE_OBJC 57 59 60 enum { 61 XPC_ACTIVITY_STATE_CHECK_IN, 62 XPC_ACTIVITY_STATE_WAIT, 63 XPC_ACTIVITY_STATE_RUN, 64 XPC_ACTIVITY_STATE_DEFER, 65 XPC_ACTIVITY_STATE_CONTINUE, 66 XPC_ACTIVITY_STATE_DONE, 67 }; 68 typedef long xpc_activity_state_t; 58 69 typedef const struct _xpc_type_s* xpc_type_t; 70 extern "C" const xpc_object_t XPC_ACTIVITY_CHECK_IN; 59 71 60 72 #if PLATFORM(IOS_FAMILY) && __has_attribute(noescape) … … 72 84 #define XPC_ARRAY_APPEND ((size_t)(-1)) 73 85 #define XPC_CONNECTION_MACH_SERVICE_LISTENER (1 << 0) 86 #define XPC_ERROR_CONNECTION_INTERRUPTED XPC_GLOBAL_OBJECT(_xpc_error_connection_interrupted) 74 87 #define XPC_ERROR_CONNECTION_INVALID XPC_GLOBAL_OBJECT(_xpc_error_connection_invalid) 75 88 #define XPC_ERROR_KEY_DESCRIPTION _xpc_error_key_description … … 85 98 extern const char * const _xpc_error_key_description; 86 99 100 extern "C" void xpc_connection_activate(xpc_connection_t connection); 101 extern "C" const void* xpc_dictionary_get_data(xpc_object_t xdict, const char* key, size_t* length); 102 extern "C" xpc_object_t xpc_data_create_with_dispatch_data(dispatch_data_t ddata); 103 extern "C" xpc_activity_state_t xpc_activity_get_state(xpc_activity_t activity); 104 extern "C" xpc_object_t xpc_activity_copy_criteria(xpc_activity_t activity); 105 extern "C" void xpc_activity_set_criteria(xpc_activity_t activity, xpc_object_t criteria); 106 #if COMPILER_SUPPORTS(BLOCKS) 107 typedef void (^xpc_activity_handler_t)(xpc_activity_t activity); 108 extern "C" void xpc_activity_register(const char *identifier, xpc_object_t criteria, 109 xpc_activity_handler_t handler); 110 #endif // COMPILER_SUPPORTS(BLOCKS) 111 87 112 #endif // PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK) 88 113 … … 91 116 #include <xpc/private.h> 92 117 #else 118 119 extern "C" const char * const XPC_ACTIVITY_RANDOM_INITIAL_DELAY; 120 extern "C" const char * const XPC_ACTIVITY_REQUIRE_NETWORK_CONNECTIVITY; 93 121 94 122 #if OS_OBJECT_USE_OBJC … … 109 137 WTF_EXTERN_C_BEGIN 110 138 139 extern const struct _xpc_dictionary_s _xpc_error_connection_interrupted; 111 140 extern const struct _xpc_dictionary_s _xpc_error_connection_invalid; 112 141 extern const struct _xpc_dictionary_s _xpc_error_termination_imminent; -
trunk/Source/WebKit/ChangeLog
r282222 r282230 1 2021-09-09 Alex Christensen <achristensen@webkit.org> 2 3 Add PrivateClickMeasurement daemon 4 https://bugs.webkit.org/show_bug.cgi?id=230052 5 6 Reviewed by Chris Dumez. 7 8 This adds the infrastructure to use a daemon instead of the network process to handle PrivateClickMeasurement. 9 It does not start using the daemon yet, so there is no change in behavior. 10 I made a new class PCM::ManagerInterface which can either be a PrivateClickMeasurementManager or a PCM::ManagerProxy, 11 which would send messages to the daemon instead of doing the work locally. 12 I implemented the encoding and decoding of parameters using some of the IPC encoding templates. 13 I have an entry point for an executable but no executable yet. 14 I have verified that EventAttribution unit tests pass when using the daemon, so the infrastructure is good. 15 16 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 17 * NetworkProcess/NetworkSession.cpp: 18 (WebKit::NetworkSession::NetworkSession): 19 (WebKit::pcmStoreDirectory): Deleted. 20 * NetworkProcess/NetworkSession.h: 21 (WebKit::NetworkSession::privateClickMeasurement): 22 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp: Added. 23 (WebKit::PCM::Connection::connectionToDaemon): 24 (WebKit::PCM::Connection::send): 25 (WebKit::PCM::Connection::sendWithReply): 26 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h: Added. 27 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp: Added. 28 (WebKit::PCM::DaemonClient::loadFromNetwork): 29 (WebKit::PCM::DaemonClient::broadcastConsoleMessage): 30 (WebKit::PCM::DaemonClient::featureEnabled const): 31 (WebKit::PCM::DaemonClient::debugModeEnabled const): 32 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h: Added. 33 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp: Added. 34 (WebKit::PCM::Decoder::bufferIsLargeEnoughToContainBytes const): 35 (WebKit::PCM::Decoder::decodeFixedLengthData): 36 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h: Added. 37 (WebKit::PCM::Decoder::Decoder): 38 (WebKit::PCM::Decoder::operator>>): 39 (WebKit::PCM::Decoder::bufferIsLargeEnoughToContain const): 40 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp: Added. 41 (WebKit::PCM::Encoder::encodeFixedLengthData): 42 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.h: Added. 43 (WebKit::PCM::Encoder::operator<<): 44 (WebKit::PCM::Encoder::encode): 45 (WebKit::PCM::Encoder::takeBuffer): 46 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp: Added. 47 (WebKit::PCM::MessageInfo::toStringForTesting::encodeReply): 48 (WebKit::PCM::manager): 49 (WebKit::PCM::handlePCMMessage): 50 (WebKit::PCM::handlePCMMessageWithReply): 51 (WebKit::PCM::decodeMessageAndSendToManager): 52 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h: Added. 53 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp: Added. 54 (WebKit::PCM::sendMessage): 55 (WebKit::PCM::ReplyCaller<>::callReply): 56 (WebKit::PCM::ReplyCaller<String>::callReply): 57 (WebKit::PCM::sendMessageWithReply): 58 (WebKit::PCM::ManagerProxy::storeUnattributed): 59 (WebKit::PCM::ManagerProxy::handleAttribution): 60 (WebKit::PCM::ManagerProxy::clear): 61 (WebKit::PCM::ManagerProxy::clearForRegistrableDomain): 62 (WebKit::PCM::ManagerProxy::migratePrivateClickMeasurementFromLegacyStorage): 63 (WebKit::PCM::ManagerProxy::toStringForTesting const): 64 (WebKit::PCM::ManagerProxy::setOverrideTimerForTesting): 65 (WebKit::PCM::ManagerProxy::setTokenPublicKeyURLForTesting): 66 (WebKit::PCM::ManagerProxy::setTokenSignatureURLForTesting): 67 (WebKit::PCM::ManagerProxy::setAttributionReportURLsForTesting): 68 (WebKit::PCM::ManagerProxy::markAllUnattributedAsExpiredForTesting): 69 (WebKit::PCM::ManagerProxy::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 70 (WebKit::PCM::ManagerProxy::setEphemeralMeasurementForTesting): 71 (WebKit::PCM::ManagerProxy::setPCMFraudPreventionValuesForTesting): 72 (WebKit::PCM::ManagerProxy::startTimerImmediatelyForTesting): 73 (WebKit::PCM::ManagerProxy::destroyStoreForTesting): 74 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h: Added. 75 * NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm: Added. 76 (WebKit::PCM::Connection::Connection): 77 (WebKit::PCM::Connection::connectionToDaemon): 78 (WebKit::PCM::dictionaryFromMessage): 79 (WebKit::PCM::Connection::send): 80 (WebKit::PCM::Connection::sendWithReply): 81 * NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.h: Added. 82 * NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm: Added. 83 (WebKit::PCM::addVersionAndEncodedMessageToDictionary): 84 * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: 85 * Platform/IPC/ArgumentCoder.h: 86 * Platform/IPC/ArgumentCoders.cpp: 87 (IPC::decodeStringText): 88 (IPC::ArgumentCoder<String>::decode): 89 * Platform/IPC/ArgumentCoders.h: 90 * Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.h: Added. 91 * Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm: Added. 92 (WebKit::peers): 93 (WebKit::CompletionHandler<void): 94 (WebKit::connectionEventHandler): 95 (WebKit::startListeningForMachServiceConnections): 96 (WebKit::registerScheduledActivityHandler): 97 (WebKit::enterSandbox): 98 (WebKit::PCMDaemonMain): 99 * Sources.txt: 100 * SourcesCocoa.txt: 101 * WebKit.xcodeproj/project.pbxproj: 102 1 103 2021-09-09 Sihui Liu <sihui_liu@apple.com> 2 104 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r282006 r282230 34 34 #include "PluginProcessProxy.h" 35 35 #include "PrivateClickMeasurementManager.h" 36 #include "PrivateClickMeasurementManagerProxy.h" 36 37 #include "ResourceLoadStatisticsMemoryStore.h" 37 38 #include "StorageAccessStatus.h" -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r282109 r282230 38 38 #include "PrivateClickMeasurementClientImpl.h" 39 39 #include "PrivateClickMeasurementManager.h" 40 #include "PrivateClickMeasurementManagerProxy.h" 40 41 #include "WebPageProxy.h" 41 42 #include "WebPageProxyMessages.h" … … 93 94 } 94 95 96 static UniqueRef<PCM::ManagerInterface> managerOrProxy(NetworkSession& networkSession, NetworkProcess& networkProcess, const NetworkSessionCreationParameters& parameters) 97 { 98 // FIXME: Turn this on and remove ManagerInterface once rdar://80701098 is closed. 99 constexpr bool usePCMDaemon = false; 100 101 if (usePCMDaemon) 102 return makeUniqueRef<PCM::ManagerProxy>(); 103 return makeUniqueRef<PrivateClickMeasurementManager>(makeUniqueRef<PCM::ClientImpl>(networkSession, networkProcess), pcmStoreDirectory(networkSession, parameters.resourceLoadStatisticsParameters.directory, parameters.resourceLoadStatisticsParameters.privateClickMeasurementStorageDirectory)); 104 } 105 95 106 NetworkSession::NetworkSession(NetworkProcess& networkProcess, const NetworkSessionCreationParameters& parameters) 96 107 : m_sessionID(parameters.sessionID) 97 108 , m_networkProcess(networkProcess) 98 109 #if ENABLE(RESOURCE_LOAD_STATISTICS) 99 , m_privateClickMeasurementStorageDirectory(parameters.resourceLoadStatisticsParameters.privateClickMeasurementStorageDirectory)100 110 , m_resourceLoadStatisticsDirectory(parameters.resourceLoadStatisticsParameters.directory) 101 111 , m_shouldIncludeLocalhostInResourceLoadStatistics(parameters.resourceLoadStatisticsParameters.shouldIncludeLocalhost ? ShouldIncludeLocalhost::Yes : ShouldIncludeLocalhost::No) … … 108 118 , m_standaloneApplicationDomain(parameters.resourceLoadStatisticsParameters.standaloneApplicationDomain) 109 119 #endif 120 , m_privateClickMeasurement(managerOrProxy(*this, networkProcess, parameters)) 110 121 , m_broadcastChannelRegistry(makeUniqueRef<NetworkBroadcastChannelRegistry>()) 111 122 , m_testSpeedMultiplier(parameters.testSpeedMultiplier) … … 142 153 setResourceLoadStatisticsEnabled(parameters.resourceLoadStatisticsParameters.enabled); 143 154 #endif 144 m_privateClickMeasurement = makeUnique<PrivateClickMeasurementManager>(makeUniqueRef<PCM::ClientImpl>(*this, networkProcess), pcmStoreDirectory(*this, parameters.resourceLoadStatisticsParameters.directory, parameters.resourceLoadStatisticsParameters.privateClickMeasurementStorageDirectory));145 155 } 146 156 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r282110 r282230 30 30 #include "NetworkResourceLoadIdentifier.h" 31 31 #include "PrefetchCache.h" 32 #include "PrivateClickMeasurementManagerInterface.h" 32 33 #include "SandboxExtension.h" 33 34 #include "ServiceWorkerSoftUpdateLoader.h" … … 61 62 class NetworkBroadcastChannelRegistry; 62 63 class NetworkSocketChannel; 63 class PrivateClickMeasurementManager;64 64 class WebPageNetworkParameters; 65 65 class WebResourceLoadStatisticsStore; … … 168 168 169 169 NetworkLoadScheduler& networkLoadScheduler(); 170 P rivateClickMeasurementManager& privateClickMeasurement() { return *m_privateClickMeasurement; }170 PCM::ManagerInterface& privateClickMeasurement() { return m_privateClickMeasurement.get(); } 171 171 172 172 #if PLATFORM(COCOA) … … 193 193 WeakHashSet<NetworkDataTask> m_dataTaskSet; 194 194 #if ENABLE(RESOURCE_LOAD_STATISTICS) 195 String m_privateClickMeasurementStorageDirectory;196 195 String m_resourceLoadStatisticsDirectory; 197 196 RefPtr<WebResourceLoadStatisticsStore> m_resourceLoadStatistics; … … 209 208 #endif 210 209 bool m_isStaleWhileRevalidateEnabled { false }; 211 std::unique_ptr<PrivateClickMeasurementManager> m_privateClickMeasurement;210 UniqueRef<PCM::ManagerInterface> m_privateClickMeasurement; 212 211 213 212 HashSet<Ref<NetworkResourceLoader>> m_keptAliveLoads; -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i mport"config.h"27 #i mport "LocalStorageDatabaseTracker.h"26 #include "config.h" 27 #include "PrivateClickMeasurementConnection.h" 28 28 29 #if PLATFORM(IOS_FAMILY) 30 31 #import <WebCore/VersionChecks.h> 29 #include <WebCore/NotImplemented.h> 32 30 33 31 namespace WebKit { 34 32 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 33 namespace PCM { 34 35 #if !PLATFORM(COCOA) 36 37 Connection Connection::connectionToDaemon() 36 38 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 40 41 m_hasExcludedFromBackup = true; 42 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; 39 notImplemented(); 40 return { }; 44 41 } 45 42 46 } // namespace WebKit 43 void Connection::send(MessageType, EncodedMessage&&) 44 { 45 notImplemented(); 46 } 47 48 void Connection::sendWithReply(MessageType, EncodedMessage&&, CompletionHandler<void(EncodedMessage&&)>&& completionHandler) 49 { 50 notImplemented(); 51 completionHandler({ }); 52 } 47 53 48 54 #endif 55 56 } // namespace PCM 57 58 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "LocalStorageDatabaseTracker.h" 26 #pragma once 28 27 29 #i f PLATFORM(IOS_FAMILY)28 #include <wtf/Vector.h> 30 29 31 #import <WebCore/VersionChecks.h> 30 #if PLATFORM(COCOA) 31 #include <wtf/OSObjectPtr.h> 32 #include <wtf/spi/darwin/XPCSPI.h> 33 #endif 32 34 33 35 namespace WebKit { 34 36 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 36 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 37 namespace PCM { 40 38 41 m_hasExcludedFromBackup = true; 39 enum class MessageType : uint8_t; 40 using EncodedMessage = Vector<uint8_t>; 42 41 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; 44 } 42 class Connection { 43 public: 44 static Connection connectionToDaemon(); 45 46 void send(MessageType, EncodedMessage&&); 47 void sendWithReply(MessageType, EncodedMessage&&, CompletionHandler<void(EncodedMessage&&)>&&); 48 49 private: 50 #if PLATFORM(COCOA) 51 Connection(OSObjectPtr<xpc_connection_t>&&); 52 53 OSObjectPtr<xpc_connection_t> m_connection; 54 #endif 55 }; 56 57 } // namespace PCM 45 58 46 59 } // namespace WebKit 47 48 #endif -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp
r282226 r282230 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "PrivateClickMeasurementDaemonClient.h" 27 28 28 #include <WebKit/WKBase.h> 29 #include <WebKit/WKFoundation.h> 29 #include <WebCore/NotImplemented.h> 30 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 31 namespace WebKit { 34 32 35 WK_EXPORT int WKXPCServiceMain(int argc, const char** argv) WK_API_AVAILABLE(macos(10.15), ios(13.0)); 33 namespace PCM { 36 34 37 #ifdef __cplusplus 35 void DaemonClient::broadcastConsoleMessage(JSC::MessageLevel, const String&) 36 { 37 notImplemented(); 38 38 } 39 #endif 39 40 bool DaemonClient::featureEnabled() const 41 { 42 return true; 43 } 44 45 bool DaemonClient::debugModeEnabled() const 46 { 47 notImplemented(); 48 return false; 49 } 50 51 } // namespace PCM 52 53 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include <WebKit/WKBase.h> 29 #include <WebKit/WKFoundation.h> 28 #include "PrivateClickMeasurementClient.h" 29 #include <wtf/FastMalloc.h> 30 #include <wtf/WeakPtr.h> 30 31 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 32 namespace WebKit { 34 33 35 WK_EXPORT int WKXPCServiceMain(int argc, const char** argv) WK_API_AVAILABLE(macos(10.15), ios(13.0)); 34 namespace PCM { 36 35 37 #ifdef __cplusplus 38 } 39 #endif 36 class DaemonClient : public Client, public CanMakeWeakPtr<DaemonClient> { 37 WTF_MAKE_FAST_ALLOCATED; 38 void broadcastConsoleMessage(JSC::MessageLevel, const String&) final; 39 bool featureEnabled() const final; 40 bool debugModeEnabled() const final; 41 }; 42 43 } // namespace PCM 44 45 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "LocalStorageDatabaseTracker.h" 28 29 #if PLATFORM(IOS_FAMILY) 30 31 #import <WebCore/VersionChecks.h> 26 #include "config.h" 27 #include "PrivateClickMeasurementDecoder.h" 32 28 33 29 namespace WebKit { 34 30 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 31 namespace PCM { 32 33 bool Decoder::bufferIsLargeEnoughToContainBytes(size_t bytes) const 36 34 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 40 41 m_hasExcludedFromBackup = true; 42 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; 35 return bytes <= m_buffer.size() - m_bufferPosition; 44 36 } 45 37 38 bool Decoder::decodeFixedLengthData(uint8_t* data, size_t size, size_t) 39 { 40 if (!bufferIsLargeEnoughToContainBytes(size)) 41 return false; 42 memcpy(data, m_buffer.data() + m_bufferPosition, size); 43 m_bufferPosition += size; 44 return true; 45 } 46 47 } // namespace PCM 48 46 49 } // namespace WebKit 47 48 #endif -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "LocalStorageDatabaseTracker.h" 26 #pragma once 28 27 29 #if PLATFORM(IOS_FAMILY) 30 31 #import <WebCore/VersionChecks.h> 28 #include "ArgumentCoders.h" 32 29 33 30 namespace WebKit { 34 31 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 36 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 32 namespace PCM { 40 33 41 m_hasExcludedFromBackup = true; 34 class Decoder { 35 public: 36 Decoder(Vector<uint8_t>&& buffer) 37 : m_buffer(WTFMove(buffer)) { } 38 39 template<typename T> 40 Decoder& operator>>(std::optional<T>& t) 41 { 42 t = IPC::ArgumentCoder<std::remove_const_t<std::remove_reference_t<T>>, void>::decode(*this); 43 return *this; 44 } 42 45 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; 44 } 46 template<typename T> 47 WARN_UNUSED_RETURN bool bufferIsLargeEnoughToContain(size_t numElements) const 48 { 49 static_assert(std::is_arithmetic<T>::value, "Type T must have a fixed, known encoded size!"); 50 51 if (numElements > std::numeric_limits<size_t>::max() / sizeof(T)) 52 return false; 53 54 return bufferIsLargeEnoughToContainBytes(numElements * sizeof(T)); 55 } 56 57 WARN_UNUSED_RETURN bool decodeFixedLengthData(uint8_t* data, size_t, size_t alignment); 58 59 private: 60 WARN_UNUSED_RETURN bool bufferIsLargeEnoughToContainBytes(size_t) const; 61 62 Vector<uint8_t> m_buffer; 63 size_t m_bufferPosition { 0 }; 64 }; 65 66 } // namespace PCM 45 67 46 68 } // namespace WebKit 47 48 #endif -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp
r282226 r282230 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "PrivateClickMeasurementEncoder.h" 27 28 28 #include <WebKit/WKBase.h> 29 #include <WebKit/WKFoundation.h> 29 namespace WebKit { 30 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 31 namespace PCM { 34 32 35 WK_EXPORT int WKXPCServiceMain(int argc, const char** argv) WK_API_AVAILABLE(macos(10.15), ios(13.0)); 33 void Encoder::encodeFixedLengthData(const uint8_t* data, size_t size, size_t) 34 { 35 m_buffer.append(data, size); 36 } 36 37 37 #ifdef __cplusplus 38 } 39 #endif 38 } // namespace PCM 39 40 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "LocalStorageDatabaseTracker.h" 26 #pragma once 28 27 29 #if PLATFORM(IOS_FAMILY) 30 31 #import <WebCore/VersionChecks.h> 28 #include "ArgumentCoders.h" 32 29 33 30 namespace WebKit { 34 31 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 36 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 32 namespace PCM { 40 33 41 m_hasExcludedFromBackup = true; 34 class Encoder { 35 public: 36 template<typename T> 37 Encoder& operator<<(T&& t) 38 { 39 IPC::ArgumentCoder<std::remove_const_t<std::remove_reference_t<T>>>::encode(*this, std::forward<T>(t)); 40 return *this; 41 } 42 42 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; 44 } 43 template<typename Arg, typename... Args> 44 void encode(Arg&& arg, Args&&... args) 45 { 46 *this << std::forward<Arg>(arg); 47 encode(std::forward<Args>(args)...); 48 } 49 void encode() { } 50 51 Vector<uint8_t> takeBuffer() { return std::exchange(m_buffer, { }); } 52 53 void encodeFixedLengthData(const uint8_t*, size_t, size_t alignment); 54 55 private: 56 Vector<uint8_t> m_buffer; 57 }; 58 59 } // namespace PCM 45 60 46 61 } // namespace WebKit 47 48 #endif -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h
r282109 r282230 29 29 #include "NetworkProcess.h" 30 30 #include "PrivateClickMeasurementClient.h" 31 #include "PrivateClickMeasurementManagerInterface.h" 31 32 #include "PrivateClickMeasurementStore.h" 32 #include <WebCore/PrivateClickMeasurement.h>33 #include <WebCore/RegistrableDomain.h>34 #include <WebCore/ResourceError.h>35 #include <WebCore/ResourceResponse.h>36 33 #include <WebCore/Timer.h> 37 #include <pal/SessionID.h>38 34 #include <wtf/CompletionHandler.h> 39 35 #include <wtf/JSONValues.h> … … 43 39 namespace WebKit { 44 40 45 enum class PrivateClickMeasurementAttributionType : bool { Unattributed, Attributed }; 46 47 class PrivateClickMeasurementManager : public CanMakeWeakPtr<PrivateClickMeasurementManager> { 41 class PrivateClickMeasurementManager : public PCM::ManagerInterface, public CanMakeWeakPtr<PrivateClickMeasurementManager> { 48 42 WTF_MAKE_FAST_ALLOCATED; 49 43 public: 50 51 using AttributionDestinationSite = WebCore::PrivateClickMeasurement::AttributionDestinationSite;52 using AttributionTriggerData = WebCore::PrivateClickMeasurement::AttributionTriggerData;53 using PrivateClickMeasurement = WebCore::PrivateClickMeasurement;54 using RegistrableDomain = WebCore::RegistrableDomain;55 using SourceSite = WebCore::PrivateClickMeasurement::SourceSite;56 44 57 45 explicit PrivateClickMeasurementManager(UniqueRef<PCM::Client>&&, const String& storageDirectory); 58 46 ~PrivateClickMeasurementManager(); 59 47 60 void storeUnattributed(PrivateClickMeasurement&&) ;61 void handleAttribution(AttributionTriggerData&&, const URL& requestURL, WebCore::RegistrableDomain&& redirectDomain, const URL& firstPartyURL) ;62 void clear(CompletionHandler<void()>&&) ;63 void clearForRegistrableDomain(const RegistrableDomain&, CompletionHandler<void()>&&) ;64 void migratePrivateClickMeasurementFromLegacyStorage(PrivateClickMeasurement&&, PrivateClickMeasurementAttributionType) ;48 void storeUnattributed(PrivateClickMeasurement&&) final; 49 void handleAttribution(AttributionTriggerData&&, const URL& requestURL, WebCore::RegistrableDomain&& redirectDomain, const URL& firstPartyURL) final; 50 void clear(CompletionHandler<void()>&&) final; 51 void clearForRegistrableDomain(const RegistrableDomain&, CompletionHandler<void()>&&) final; 52 void migratePrivateClickMeasurementFromLegacyStorage(PrivateClickMeasurement&&, PrivateClickMeasurementAttributionType) final; 65 53 66 void toStringForTesting(CompletionHandler<void(String)>&&) const ;67 void setOverrideTimerForTesting(bool value) { m_isRunningTest = value; }68 void setTokenPublicKeyURLForTesting(URL&&) ;69 void setTokenSignatureURLForTesting(URL&&) ;70 void setAttributionReportURLsForTesting(URL&& sourceURL, URL&& destinationURL) ;71 void markAllUnattributedAsExpiredForTesting() ;72 void markAttributedPrivateClickMeasurementsAsExpiredForTesting(CompletionHandler<void()>&&) ;73 void setEphemeralMeasurementForTesting(bool value) { m_isRunningEphemeralMeasurementTest = value; }74 void setPCMFraudPreventionValuesForTesting(String&& unlinkableToken, String&& secretToken, String&& signature, String&& keyID) ;75 void startTimerImmediatelyForTesting() ;76 void destroyStoreForTesting(CompletionHandler<void()>&&) ;54 void toStringForTesting(CompletionHandler<void(String)>&&) const final; 55 void setOverrideTimerForTesting(bool value) final { m_isRunningTest = value; } 56 void setTokenPublicKeyURLForTesting(URL&&) final; 57 void setTokenSignatureURLForTesting(URL&&) final; 58 void setAttributionReportURLsForTesting(URL&& sourceURL, URL&& destinationURL) final; 59 void markAllUnattributedAsExpiredForTesting() final; 60 void markAttributedPrivateClickMeasurementsAsExpiredForTesting(CompletionHandler<void()>&&) final; 61 void setEphemeralMeasurementForTesting(bool value) final { m_isRunningEphemeralMeasurementTest = value; } 62 void setPCMFraudPreventionValuesForTesting(String&& unlinkableToken, String&& secretToken, String&& signature, String&& keyID) final; 63 void startTimerImmediatelyForTesting() final; 64 void destroyStoreForTesting(CompletionHandler<void()>&&) final; 77 65 78 66 private: -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm
r282121 r282230 53 53 - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler 54 54 { 55 // FIXME: Add plubming so that we can tell the daemon which certificates to accept without using NetworkSessionCocoa. 55 56 if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] 56 57 && NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(challenge)) -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "WKMain.h" 26 #pragma once 28 27 29 #i mport "XPCServiceEntryPoint.h"28 #include <wtf/spi/darwin/XPCSPI.h> 30 29 31 int WKXPCServiceMain(int argc, const char** argv) 32 { 33 return WebKit::XPCServiceMain(argc, argv); 34 } 30 namespace WebKit { 31 32 namespace PCM { 33 34 void addVersionAndEncodedMessageToDictionary(Vector<uint8_t>&&, xpc_object_t); 35 36 } // namespace PCM 37 38 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm
r282226 r282230 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #import "config.h" 27 #import "LocalStorageDatabaseTracker.h" 28 29 #if PLATFORM(IOS_FAMILY) 30 31 #import <WebCore/VersionChecks.h> 27 #import "PrivateClickMeasurementXPCUtilities.h" 32 28 33 29 namespace WebKit { 34 30 35 void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const 31 namespace PCM { 32 33 void addVersionAndEncodedMessageToDictionary(Vector<uint8_t>&& message, xpc_object_t dictionary) 36 34 { 37 ASSERT(!RunLoop::isMain()); 38 if (m_hasExcludedFromBackup) 39 return; 35 ASSERT(xpc_get_type(dictionary) == XPC_TYPE_DICTIONARY); 36 xpc_dictionary_set_uint64(dictionary, PCM::protocolVersionKey, PCM::protocolVersionValue); 40 37 41 m_hasExcludedFromBackup = true; 38 auto bufferSize = message.size(); 39 auto rawPointer = message.releaseBuffer().leakPtr(); 40 auto dispatchData = adoptNS(dispatch_data_create(rawPointer, bufferSize, dispatch_get_main_queue(), ^{ 41 fastFree(rawPointer); 42 })); 43 auto xpcData = adoptOSObject(xpc_data_create_with_dispatch_data(dispatchData.get())); 44 xpc_dictionary_set_value(dictionary, PCM::protocolEncodedMessageKey, xpcData.get()); 42 45 43 [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];44 46 } 45 47 48 } // namespace PCM 49 46 50 } // namespace WebKit 47 48 #endif -
trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm
r267966 r282230 30 30 31 31 #import <WebCore/VersionChecks.h> 32 #import <wtf/RunLoop.h> 32 33 33 34 namespace WebKit { -
trunk/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in
r278952 r282230 358 358 ) 359 359 360 (allow mach-lookup (global-name "com.apple.webkit.adattributiond.service")) 361 360 362 (with-filter (uid 0) 361 363 (allow mach-lookup -
trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h
r278458 r282230 49 49 } 50 50 51 template<typename Decoder> 51 52 static std::optional<T> decode(Decoder& decoder) 52 53 { … … 83 84 } 84 85 86 template<typename Decoder> 85 87 static std::optional<T> decode(Decoder& decoder) 86 88 { … … 101 103 } 102 104 105 template<typename Decoder> 103 106 static std::optional<T> decode(Decoder& decoder) 104 107 { -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp
r278619 r282230 28 28 29 29 #include "DataReference.h" 30 #include "PrivateClickMeasurementDecoder.h" 31 #include "PrivateClickMeasurementEncoder.h" 30 32 #include "StreamConnectionEncoder.h" 31 33 #include <wtf/text/CString.h> … … 34 36 namespace IPC { 35 37 38 template<typename Encoder> 36 39 void ArgumentCoder<WallTime>::encode(Encoder& encoder, const WallTime& time) 37 40 { 38 41 encoder << time.secondsSinceEpoch().value(); 39 42 } 43 template 44 void ArgumentCoder<WallTime>::encode<Encoder>(Encoder&, const WallTime&); 45 template 46 void ArgumentCoder<WallTime>::encode<WebKit::PCM::Encoder>(WebKit::PCM::Encoder&, const WallTime&); 40 47 41 48 WARN_UNUSED_RETURN bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time) … … 49 56 } 50 57 58 template<typename Decoder> 51 59 WARN_UNUSED_RETURN std::optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder) 52 60 { … … 57 65 return WallTime::fromRawSeconds(*time); 58 66 } 67 template 68 std::optional<WallTime> ArgumentCoder<WallTime>::decode<Decoder>(Decoder&); 69 template 70 std::optional<WallTime> ArgumentCoder<WallTime>::decode<WebKit::PCM::Decoder>(WebKit::PCM::Decoder&); 59 71 60 72 void ArgumentCoder<AtomString>::encode(Encoder& encoder, const AtomString& atomString) … … 134 146 template 135 147 void ArgumentCoder<String>::encode<StreamConnectionEncoder>(StreamConnectionEncoder&, const String&); 136 137 template <typename CharacterType> 148 template 149 void ArgumentCoder<String>::encode<WebKit::PCM::Encoder>(WebKit::PCM::Encoder&, const String&); 150 151 template<typename CharacterType, typename Decoder> 138 152 static inline std::optional<String> decodeStringText(Decoder& decoder, uint32_t length) 139 153 { 140 154 // Before allocating the string, make sure that the decoder buffer is big enough. 141 if (!decoder. bufferIsLargeEnoughToContain<CharacterType>(length))155 if (!decoder.template bufferIsLargeEnoughToContain<CharacterType>(length)) 142 156 return std::nullopt; 143 157 … … 150 164 } 151 165 166 template<typename Decoder> 152 167 WARN_UNUSED_RETURN std::optional<String> ArgumentCoder<String>::decode(Decoder& decoder) 153 168 { 154 uint32_t length; 155 if (!decoder.decode(length)) 156 return std::nullopt; 157 158 if (length == std::numeric_limits<uint32_t>::max()) { 169 std::optional<uint32_t> length; 170 decoder >> length; 171 if (!length) 172 return std::nullopt; 173 174 if (*length == std::numeric_limits<uint32_t>::max()) { 159 175 // This is the null string. 160 176 return String(); 161 177 } 162 178 163 bool is8Bit; 164 if (!decoder.decode(is8Bit)) 165 return std::nullopt; 166 167 if (is8Bit) 168 return decodeStringText<LChar>(decoder, length); 169 return decodeStringText<UChar>(decoder, length); 170 } 179 std::optional<bool> is8Bit; 180 decoder >> is8Bit; 181 if (!is8Bit) 182 return std::nullopt; 183 184 if (*is8Bit) 185 return decodeStringText<LChar>(decoder, *length); 186 return decodeStringText<UChar>(decoder, *length); 187 } 188 template 189 std::optional<String> ArgumentCoder<String>::decode<Decoder>(Decoder&); 190 template 191 std::optional<String> ArgumentCoder<String>::decode<WebKit::PCM::Decoder>(WebKit::PCM::Decoder&); 171 192 172 193 WARN_UNUSED_RETURN bool ArgumentCoder<String>::decode(Decoder& decoder, String& result) -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
r278338 r282230 301 301 template<typename Type, typename... Types> 302 302 struct TupleDecoderImpl { 303 template<typename Decoder> 303 304 static std::optional<std::tuple<Type, Types...>> decode(Decoder& decoder) 304 305 { … … 318 319 template<typename Type> 319 320 struct TupleDecoderImpl<Type> { 321 template<typename Decoder> 320 322 static std::optional<std::tuple<Type>> decode(Decoder& decoder) 321 323 { … … 330 332 template<size_t size, typename... Elements> 331 333 struct TupleDecoder { 334 template<typename Decoder> 332 335 static std::optional<std::tuple<Elements...>> decode(Decoder& decoder) 333 336 { … … 338 341 template<> 339 342 struct TupleDecoder<0> { 343 template<typename Decoder> 340 344 static std::optional<std::tuple<>> decode(Decoder&) 341 345 { … … 351 355 } 352 356 357 template<typename Decoder> 353 358 static std::optional<std::tuple<Elements...>> decode(Decoder& decoder) 354 359 { … … 722 727 723 728 template<> struct ArgumentCoder<WallTime> { 729 template<typename Encoder> 724 730 static void encode(Encoder&, const WallTime&); 725 731 static WARN_UNUSED_RETURN bool decode(Decoder&, WallTime&); 732 template<typename Decoder> 726 733 static std::optional<WallTime> decode(Decoder&); 727 734 }; … … 741 748 static void encode(Encoder&, const String&); 742 749 static WARN_UNUSED_RETURN bool decode(Decoder&, String&); 750 template<typename Decoder> 743 751 static std::optional<String> decode(Decoder&); 744 752 }; -
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.h
r252174 r282230 34 34 35 35 WK_EXPORT int WKXPCServiceMain(int argc, const char** argv) WK_API_AVAILABLE(macos(10.15), ios(13.0)); 36 WK_EXPORT int WKPCMDaemonMain(int argc, const char** argv) WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 36 37 37 38 #ifdef __cplusplus -
trunk/Source/WebKit/Shared/API/Cocoa/WKMain.mm
r260366 r282230 27 27 #import "WKMain.h" 28 28 29 #import "PCMDaemonEntryPoint.h" 29 30 #import "XPCServiceEntryPoint.h" 30 31 … … 33 34 return WebKit::XPCServiceMain(argc, argv); 34 35 } 36 37 int WKPCMDaemonMain(int argc, const char** argv) 38 { 39 return WebKit::PCMDaemonMain(argc, argv); 40 } -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.h
r282226 r282230 1 1 /* 2 * Copyright (C) 20 19Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "WKMain.h" 26 #pragma once 28 27 29 #import "XPCServiceEntryPoint.h" 28 namespace WebKit { 30 29 31 int WKXPCServiceMain(int argc, const char** argv) 32 { 33 return WebKit::XPCServiceMain(argc, argv); 34 } 30 int PCMDaemonMain(int, const char**); 31 32 } // namespace WebKit -
trunk/Source/WebKit/Sources.txt
r282130 r282230 102 102 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDebugInfo.cpp 103 103 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp 104 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp 104 105 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp 105 106 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp 107 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp 108 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp 109 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp 110 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp 111 NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp 106 112 107 113 NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp @no-unify -
trunk/Source/WebKit/SourcesCocoa.txt
r282110 r282230 42 42 NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm 43 43 44 NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm 44 45 NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm 46 NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm 45 47 46 48 NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm … … 191 193 Shared/Cocoa/WKObject.mm 192 194 Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm 195 196 Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm 193 197 194 198 Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r282189 r282230 1292 1292 5CB7AFE723C6820700E49CF3 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB7AFE623C681B000E49CF3 /* ResourceLoadInfo.h */; }; 1293 1293 5CB7AFE823C69B6100E49CF3 /* _WKResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB7AFE323C67D3700E49CF3 /* _WKResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1294 5CB9310926E8439A0032B1C0 /* PrivateClickMeasurementXPCUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB9310726E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.h */; }; 1294 1295 5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; }; 1295 1296 5CBD595C2280EDF4002B22AA /* _WKCustomHeaderFields.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C5D2388227A1892000B9BDA /* _WKCustomHeaderFields.mm */; }; … … 4565 4566 5CB930C126E054B80032B1C0 /* PrivateClickMeasurementClientImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementClientImpl.h; sourceTree = "<group>"; }; 4566 4567 5CB930F226E7EEE00032B1C0 /* PrivateClickMeasurementNetworkLoaderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrivateClickMeasurementNetworkLoaderCocoa.mm; sourceTree = "<group>"; }; 4568 5CB930F426E801E80032B1C0 /* PrivateClickMeasurementDaemonConnectionCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PrivateClickMeasurementDaemonConnectionCocoa.mm; sourceTree = "<group>"; }; 4569 5CB930F526E802150032B1C0 /* PrivateClickMeasurementManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementManagerProxy.h; sourceTree = "<group>"; }; 4570 5CB930F626E802150032B1C0 /* PrivateClickMeasurementDaemonClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementDaemonClient.h; sourceTree = "<group>"; }; 4571 5CB930F726E802150032B1C0 /* PrivateClickMeasurementDaemonClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementDaemonClient.cpp; sourceTree = "<group>"; }; 4572 5CB930F826E802150032B1C0 /* PrivateClickMeasurementDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementDecoder.cpp; sourceTree = "<group>"; }; 4573 5CB930F926E802150032B1C0 /* PrivateClickMeasurementEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementEncoder.cpp; sourceTree = "<group>"; }; 4574 5CB930FA26E802150032B1C0 /* PrivateClickMeasurementManagerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementManagerInterface.h; sourceTree = "<group>"; }; 4575 5CB930FB26E802150032B1C0 /* PrivateClickMeasurementManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementManagerProxy.cpp; sourceTree = "<group>"; }; 4576 5CB930FC26E802160032B1C0 /* PrivateClickMeasurementConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementConnection.cpp; sourceTree = "<group>"; }; 4577 5CB930FD26E802160032B1C0 /* PrivateClickMeasurementDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementDecoder.h; sourceTree = "<group>"; }; 4578 5CB930FE26E802160032B1C0 /* PrivateClickMeasurementConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementConnection.h; sourceTree = "<group>"; }; 4579 5CB930FF26E802160032B1C0 /* PrivateClickMeasurementEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementEncoder.h; sourceTree = "<group>"; }; 4580 5CB9310426E837FC0032B1C0 /* PCMDaemonEntryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCMDaemonEntryPoint.h; sourceTree = "<group>"; }; 4581 5CB9310526E837FD0032B1C0 /* PCMDaemonEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PCMDaemonEntryPoint.mm; sourceTree = "<group>"; }; 4582 5CB9310626E839A90032B1C0 /* PrivateClickMeasurementManagerInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementManagerInterface.cpp; sourceTree = "<group>"; }; 4583 5CB9310726E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementXPCUtilities.h; sourceTree = "<group>"; }; 4584 5CB9310826E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrivateClickMeasurementXPCUtilities.mm; sourceTree = "<group>"; }; 4567 4585 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkDataTask.h; sourceTree = "<group>"; }; 4568 4586 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkDataTaskCocoa.mm; sourceTree = "<group>"; }; … … 9284 9302 5CB930C026E0542F0032B1C0 /* PrivateClickMeasurementClientImpl.cpp */, 9285 9303 5CB930C126E054B80032B1C0 /* PrivateClickMeasurementClientImpl.h */, 9304 5CB930FC26E802160032B1C0 /* PrivateClickMeasurementConnection.cpp */, 9305 5CB930FE26E802160032B1C0 /* PrivateClickMeasurementConnection.h */, 9306 5CB930F726E802150032B1C0 /* PrivateClickMeasurementDaemonClient.cpp */, 9307 5CB930F626E802150032B1C0 /* PrivateClickMeasurementDaemonClient.h */, 9286 9308 5C826D6A26D482EA008AEC91 /* PrivateClickMeasurementDatabase.cpp */, 9287 9309 5C826D6926D482EA008AEC91 /* PrivateClickMeasurementDatabase.h */, 9288 9310 5CBE909026D7FB7C005A2E95 /* PrivateClickMeasurementDebugInfo.cpp */, 9289 9311 5CBE908F26D7FB62005A2E95 /* PrivateClickMeasurementDebugInfo.h */, 9312 5CB930F826E802150032B1C0 /* PrivateClickMeasurementDecoder.cpp */, 9313 5CB930FD26E802160032B1C0 /* PrivateClickMeasurementDecoder.h */, 9314 5CB930F926E802150032B1C0 /* PrivateClickMeasurementEncoder.cpp */, 9315 5CB930FF26E802160032B1C0 /* PrivateClickMeasurementEncoder.h */, 9290 9316 6BD05864220CE8C2000BED5C /* PrivateClickMeasurementManager.cpp */, 9291 9317 6BD05863220CE8C2000BED5C /* PrivateClickMeasurementManager.h */, 9318 5CB9310626E839A90032B1C0 /* PrivateClickMeasurementManagerInterface.cpp */, 9319 5CB930FA26E802150032B1C0 /* PrivateClickMeasurementManagerInterface.h */, 9320 5CB930FB26E802150032B1C0 /* PrivateClickMeasurementManagerProxy.cpp */, 9321 5CB930F526E802150032B1C0 /* PrivateClickMeasurementManagerProxy.h */, 9292 9322 57FE688B260ABB3D00BF45E4 /* PrivateClickMeasurementNetworkLoader.cpp */, 9293 9323 57FE688A260ABB3D00BF45E4 /* PrivateClickMeasurementNetworkLoader.h */, … … 9377 9407 isa = PBXGroup; 9378 9408 children = ( 9409 5CB930F426E801E80032B1C0 /* PrivateClickMeasurementDaemonConnectionCocoa.mm */, 9379 9410 5CB930F226E7EEE00032B1C0 /* PrivateClickMeasurementNetworkLoaderCocoa.mm */, 9411 5CB9310726E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.h */, 9412 5CB9310826E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.mm */, 9380 9413 ); 9381 9414 path = cocoa; 9415 sourceTree = "<group>"; 9416 }; 9417 5CB9310326E8375B0032B1C0 /* Daemon */ = { 9418 isa = PBXGroup; 9419 children = ( 9420 5CB9310426E837FC0032B1C0 /* PCMDaemonEntryPoint.h */, 9421 5CB9310526E837FD0032B1C0 /* PCMDaemonEntryPoint.mm */, 9422 ); 9423 name = Daemon; 9424 path = Cocoa/Daemon; 9382 9425 sourceTree = "<group>"; 9383 9426 }; … … 10843 10886 isa = PBXGroup; 10844 10887 children = ( 10888 5CB9310326E8375B0032B1C0 /* Daemon */, 10845 10889 BC82836B16B3587900A278FE /* XPCService */, 10846 10890 5CE9120F2293C25F005BEC78 /* AuxiliaryProcessMain.cpp */, … … 12396 12440 57FE688C260ABB3D00BF45E4 /* PrivateClickMeasurementNetworkLoader.h in Headers */, 12397 12441 5C826D6B26D482EF008AEC91 /* PrivateClickMeasurementStore.h in Headers */, 12442 5CB9310926E8439A0032B1C0 /* PrivateClickMeasurementXPCUtilities.h in Headers */, 12398 12443 86F9536518FF58F5001DB2EF /* ProcessAssertion.h in Headers */, 12399 12444 BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
Note:
See TracChangeset
for help on using the changeset viewer.