Changeset 242303 in webkit
- Timestamp:
- Mar 1, 2019 6:29:40 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r242294 r242303 1 2019-03-01 Alex Christensen <achristensen@webkit.org> 2 3 Revert r241223, r241235, and r241287 4 https://bugs.webkit.org/show_bug.cgi?id=194427 5 <rdar://48045861> 6 7 * wtf/spi/darwin/XPCSPI.h: 8 1 9 2019-03-01 Simon Fraser <simon.fraser@apple.com> 2 10 -
trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h
r241223 r242303 157 157 void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t); 158 158 159 void xpc_connection_set_bootstrap(xpc_connection_t, xpc_object_t); 160 xpc_object_t xpc_copy_bootstrap(); 159 161 void xpc_connection_set_oneshot_instance(xpc_connection_t, uuid_t instance); 160 162 -
trunk/Source/WebKit/ChangeLog
r242302 r242303 1 2019-03-01 Alex Christensen <achristensen@webkit.org> 2 3 Revert r241223, r241235, and r241287 4 https://bugs.webkit.org/show_bug.cgi?id=194427 5 <rdar://48045861> 6 7 This caused crashes, and feature design has evolved away from needing the daemon in this form. 8 9 * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm: 10 (WebKit::DaemonMain): 11 * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: 12 * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: 13 (WebKit::XPCServiceEventHandler): 14 (WebKit::XPCServiceMain): 15 (WebKit::XPCEventHandler): Deleted. 16 (WebKit::XPCInitializationHandler): Deleted. 17 * UIProcess/API/APIProcessPoolConfiguration.h: 18 * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: 19 * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: 20 (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted. 21 (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted. 22 * UIProcess/AuxiliaryProcessProxy.cpp: 23 (WebKit::AuxiliaryProcessProxy::getLaunchOptions): 24 * UIProcess/Launcher/ProcessLauncher.h: 25 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 26 (WebKit::serviceName): 27 (WebKit::ProcessLauncher::launchProcess): 28 * UIProcess/Network/NetworkProcessProxy.cpp: 29 (WebKit::NetworkProcessProxy::getLaunchOptions): 30 * UIProcess/WebProcessPool.cpp: 31 (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted. 32 * UIProcess/WebProcessPool.h: 33 1 34 2019-03-01 Alex Christensen <achristensen@webkit.org> 2 35 -
trunk/Source/WebKit/NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm
r241223 r242303 27 27 #import "DaemonEntryPoint.h" 28 28 29 #import "XPCServiceEntryPoint.h"30 #import <wtf/spi/darwin/XPCSPI.h>31 32 29 namespace WebKit { 33 30 34 int DaemonMain(int argc, const char** argv)31 int DaemonMain(int, const char**) 35 32 { 36 if (argc < 2 || strcmp(argv[1], "WebKitNetworkingDaemon")) { 37 WTFLogAlways("Unexpected daemon parameters"); 38 return EXIT_FAILURE; 39 } 40 41 xpc_connection_t listener = xpc_connection_create_mach_service("com.apple.WebKit.NetworkingDaemon", dispatch_get_main_queue(), XPC_CONNECTION_MACH_SERVICE_LISTENER); 42 43 xpc_connection_set_event_handler(listener, ^(xpc_object_t peer) { 44 if (!peer || xpc_get_type(peer) != XPC_TYPE_CONNECTION) { 45 WTFLogAlways("Unexpected XPC object"); 46 return; 47 } 48 49 XPCEventHandler(peer, AuxiliaryProcessType::Daemon); 50 }); 51 52 xpc_connection_resume(listener); 53 CFRunLoopRun(); 54 55 return EXIT_SUCCESS; 33 return 0; 56 34 } 57 35 -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h
r241223 r242303 131 131 int XPCServiceMain(int, const char**); 132 132 133 enum class AuxiliaryProcessType { Daemon, XPCService };134 void XPCEventHandler(xpc_connection_t, AuxiliaryProcessType);135 136 133 void XPCServiceExit(OSObjectPtr<xpc_object_t>&& priorityBoostMessage); 137 134 -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
r241235 r242303 39 39 namespace WebKit { 40 40 41 void XPCInitializationHandler(xpc_object_t); 42 43 void XPCEventHandler(xpc_connection_t peer, AuxiliaryProcessType processType) 41 static void XPCServiceEventHandler(xpc_connection_t peer) 44 42 { 45 43 static xpc_object_t priorityBoostMessage = nullptr; … … 50 48 if (type == XPC_TYPE_ERROR) { 51 49 if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_TERMINATION_IMMINENT) { 52 if (processType == AuxiliaryProcessType::XPCService) { 53 // FIXME: Handle this case more gracefully. 54 exit(EXIT_FAILURE); 55 } else { 56 // FIXME: Deref the NetworkProcess object associated with this xpc connection 57 // once we have a container for such objects. 58 } 50 // FIXME: Handle this case more gracefully. 51 exit(EXIT_FAILURE); 59 52 } 60 53 } else { … … 62 55 63 56 if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "bootstrap")) { 64 XPCInitializationHandler(xpc_dictionary_get_value(event, "initialization-message"));65 66 57 CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); 67 58 CFStringRef entryPointFunctionName = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("WebKitEntryPoint")); … … 102 93 } 103 94 104 void XPCInitializationHandler(xpc_object_t event)95 int XPCServiceMain(int, const char**) 105 96 { 106 ASSERT(event);107 ASSERT(xpc_get_type(event) == XPC_TYPE_DICTIONARY);108 109 static std::once_flag once;110 std::call_once(once, [event] {111 97 #if defined(__i386__) 112 113 114 115 116 117 118 98 // FIXME: This should only be done for the 32-bit plug-in XPC service so we rely on the fact that 99 // it's the only of the XPC services that are 32-bit. We should come up with a more targeted #if check. 100 @autoreleasepool { 101 // We must set the state of AppleMagnifiedMode before NSApplication initialization so that the value will be in 102 // place before Cocoa startup logic runs and caches the value. 103 [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"AppleMagnifiedMode" : @YES }]; 104 } 119 105 #endif 120 106 107 auto bootstrap = adoptOSObject(xpc_copy_bootstrap()); 121 108 #if PLATFORM(IOS_FAMILY) 122 auto containerEnvironmentVariables = xpc_dictionary_get_value(event, "ContainerEnvironmentVariables");123 124 125 126 109 auto containerEnvironmentVariables = xpc_dictionary_get_value(bootstrap.get(), "ContainerEnvironmentVariables"); 110 xpc_dictionary_apply(containerEnvironmentVariables, ^(const char *key, xpc_object_t value) { 111 setenv(key, xpc_string_get_string_ptr(value), 1); 112 return true; 113 }); 127 114 #endif 128 115 116 if (bootstrap) { 129 117 #if PLATFORM(MAC) 130 if (const char* webKitBundleVersion = xpc_dictionary_get_string( event, "WebKitBundleVersion")) {118 if (const char* webKitBundleVersion = xpc_dictionary_get_string(bootstrap.get(), "WebKitBundleVersion")) { 131 119 CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); 132 120 NSString *expectedBundleVersion = (NSString *)CFBundleGetValueForInfoDictionaryKey(webKitBundle, kCFBundleVersionKey); … … 139 127 #endif 140 128 141 if (xpc_object_t languages = xpc_dictionary_get_value( event, "OverrideLanguages")) {129 if (xpc_object_t languages = xpc_dictionary_get_value(bootstrap.get(), "OverrideLanguages")) { 142 130 @autoreleasepool { 143 131 NSDictionary *existingArguments = [[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain]; … … 152 140 } 153 141 } 154 }); 155 } 142 } 156 143 157 int XPCServiceMain(int, const char**)158 {159 144 #if PLATFORM(MAC) 160 145 // Don't allow Apple Events in WebKit processes. This can be removed when <rdar://problem/14012823> is fixed. 161 146 setenv("__APPLEEVENTSSERVICENAME", "", 1); 162 147 163 148 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 164 149 // We don't need to talk to the dock. … … 170 155 #endif 171 156 172 xpc_main([] (xpc_connection_t peer) { 173 XPCEventHandler(peer, AuxiliaryProcessType::XPCService); 174 }); 157 xpc_main(XPCServiceEventHandler); 175 158 return 0; 176 159 } -
trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
r241556 r242303 186 186 bool suppressesConnectionTerminationOnSystemChange() const { return m_suppressesConnectionTerminationOnSystemChange; } 187 187 void setSuppressesConnectionTerminationOnSystemChange(bool suppressesConnectionTerminationOnSystemChange) { m_suppressesConnectionTerminationOnSystemChange = suppressesConnectionTerminationOnSystemChange; } 188 189 bool usesNetworkingDaemon() const { return m_usesNetworkingDaemon; }190 void setUsesNetworkingDaemon(bool usesNetworkingDaemon) { m_usesNetworkingDaemon = usesNetworkingDaemon; }191 188 #endif 192 189 … … 243 240 #if PLATFORM(COCOA) 244 241 bool m_suppressesConnectionTerminationOnSystemChange { false }; 245 bool m_usesNetworkingDaemon { false };246 242 #endif 247 243 }; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
r241556 r242303 72 72 @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macosx(10.14), ios(12.0)); 73 73 @property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 74 @property (nonatomic) BOOL usesNetworkingDaemon WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));75 74 76 75 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
r241556 r242303 327 327 } 328 328 329 - (BOOL)usesNetworkingDaemon330 {331 return _processPoolConfiguration->usesNetworkingDaemon();332 }333 334 - (void)setUsesNetworkingDaemon:(BOOL)enabled335 {336 _processPoolConfiguration->setUsesNetworkingDaemon(enabled);337 }338 339 340 329 - (void)setSuppressesConnectionTerminationOnSystemChange:(BOOL)suppressesConnectionTerminationOnSystemChange 341 330 { -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
r241654 r242303 73 73 varname = "NETWORK_PROCESS_CMD_PREFIX"; 74 74 break; 75 case ProcessLauncher::ProcessType::NetworkDaemon:76 ASSERT_NOT_REACHED();77 break;78 75 } 79 76 const char* processCmdPrefix = getenv(varname); -
trunk/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
r241223 r242303 65 65 Plugin64, 66 66 #endif 67 Network, 68 NetworkDaemon 67 Network 69 68 }; 70 69 -
trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r241654 r242303 57 57 case ProcessLauncher::ProcessType::Network: 58 58 return "com.apple.WebKit.Networking"; 59 case ProcessLauncher::ProcessType::NetworkDaemon:60 ASSERT_NOT_REACHED();61 return nullptr;62 59 #if ENABLE(NETSCAPE_PLUGIN_API) 63 60 case ProcessLauncher::ProcessType::Plugin32: … … 99 96 ASSERT(!m_xpcConnection); 100 97 101 if (m_launchOptions.processType == ProcessLauncher::ProcessType::NetworkDaemon) 102 m_xpcConnection = adoptOSObject(xpc_connection_create_mach_service("com.apple.WebKit.NetworkingDaemon", dispatch_get_main_queue(), 0)); 103 else { 104 const char* name = m_launchOptions.customWebContentServiceBundleIdentifier.isNull() ? serviceName(m_launchOptions) : m_launchOptions.customWebContentServiceBundleIdentifier.data(); 105 m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr)); 106 107 uuid_t uuid; 108 uuid_generate(uuid); 109 xpc_connection_set_oneshot_instance(m_xpcConnection.get(), uuid); 110 } 98 const char* name; 99 if (!m_launchOptions.customWebContentServiceBundleIdentifier.isNull()) 100 name = m_launchOptions.customWebContentServiceBundleIdentifier.data(); 101 else 102 name = serviceName(m_launchOptions); 103 104 m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr)); 105 106 uuid_t uuid; 107 uuid_generate(uuid); 108 xpc_connection_set_oneshot_instance(m_xpcConnection.get(), uuid); 111 109 112 110 // Inherit UI process localization. It can be different from child process default localization: … … 139 137 xpc_dictionary_set_string(initializationMessage.get(), "WebKitBundleVersion", [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"].infoDictionary[(__bridge NSString *)kCFBundleVersionKey] UTF8String]); 140 138 #endif 139 xpc_connection_set_bootstrap(m_xpcConnection.get(), initializationMessage.get()); 141 140 142 141 if (shouldLeakBoost(m_launchOptions)) { … … 173 172 clientIdentifier = [[NSBundle mainBundle] bundleIdentifier]; 174 173 174 // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need. 175 175 auto bootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0)); 176 177 xpc_dictionary_set_value(bootstrapMessage.get(), "initialization-message", initializationMessage.get());178 176 179 177 if (m_client && !m_client->isJITEnabled()) -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r242288 r242303 104 104 void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) 105 105 { 106 launchOptions.processType = m_processPool.usesNetworkingDaemon() ? ProcessLauncher::ProcessType::NetworkDaemon :ProcessLauncher::ProcessType::Network;106 launchOptions.processType = ProcessLauncher::ProcessType::Network; 107 107 AuxiliaryProcessProxy::getLaunchOptions(launchOptions); 108 108 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r242302 r242303 1529 1529 } 1530 1530 1531 bool WebProcessPool::usesNetworkingDaemon() const1532 {1533 #if PLATFORM(COCOA)1534 return m_configuration->usesNetworkingDaemon();1535 #else1536 return false;1537 #endif1538 }1539 1540 1531 void WebProcessPool::setCacheModel(CacheModel cacheModel) 1541 1532 { -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r242124 r242303 269 269 API::DownloadClient& downloadClient() { return *m_downloadClient; } 270 270 271 bool usesNetworkingDaemon() const;272 273 271 API::LegacyContextHistoryClient& historyClient() { return *m_historyClient; } 274 272 WebContextClient& client() { return m_client; }
Note: See TracChangeset
for help on using the changeset viewer.