Changeset 141051 in webkit
- Timestamp:
- Jan 28, 2013 9:58:15 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r141045 r141051 1 2013-01-28 Sam Weinig <sam@webkit.org> 2 3 Plug-ins should initialize their sandbox at creation time 4 https://bugs.webkit.org/show_bug.cgi?id=108098 5 6 Reviewed by Anders Carlsson. 7 8 Add the ability to add string key/value pairs to process creation parameters 9 to allow the plugin process to get passed the plugin path which in turn allows 10 the plugin to initialize its sandbox at the correct time. 11 12 * NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm: 13 * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm: 14 * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm: 15 (NetworkServiceInitializer): 16 * PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm: 17 (WebKit::PluginProcessMainDelegate::getExtraData): 18 (PluginProcessMainDelegate): 19 * PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm: 20 * PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm: 21 * PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm: 22 * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm: 23 (WebKit): 24 (PluginServiceInitializerDelegate): 25 (WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate): 26 (WebKit::PluginServiceInitializerDelegate::getExtraData): 27 (PluginServiceInitializer): 28 * PluginProcess/PluginProcess.cpp: 29 (WebKit::PluginProcess::initializeProcess): 30 (WebKit::PluginProcess::initializePluginProcess): 31 (WebKit::PluginProcess::initializeProcessName): 32 (WebKit::PluginProcess::initializeSandbox): 33 * PluginProcess/PluginProcess.h: 34 * PluginProcess/mac/PluginProcessMac.mm: 35 (WebKit::PluginProcess::platformInitializePluginProcess): 36 (WebKit::PluginProcess::platformInitializeProcess): 37 (WebKit::PluginProcess::initializeProcessName): 38 (WebKit::PluginProcess::initializeSandbox): 39 * Shared/ChildProcess.h: 40 (ChildProcessInitializationParameters): 41 * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h: 42 (ChildProcessMainDelegate): 43 (WebKit::ChildProcessMain): 44 * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm: 45 (WebKit::ChildProcessMainDelegate::getExtraData): 46 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h: 47 (WebKit::XPCServiceEventHandler): 48 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h: 49 (WebKit::XPCServiceEventHandler): 50 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: Added. 51 (XPCServiceInitializerDelegate): 52 (WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate): 53 (WebKit::XPCServiceInitializer): 54 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: Added. 55 (WebKit::XPCServiceInitializerDelegate::~XPCServiceInitializerDelegate): 56 (WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier): 57 (WebKit::XPCServiceInitializerDelegate::getClientIdentifier): 58 (WebKit::XPCServiceInitializerDelegate::getClientProcessName): 59 (WebKit::XPCServiceInitializerDelegate::getExtraData): 60 * Shared/Plugins/PluginProcessCreationParameters.cpp: 61 (WebKit::PluginProcessCreationParameters::encode): 62 (WebKit::PluginProcessCreationParameters::decode): 63 * Shared/Plugins/PluginProcessCreationParameters.h: 64 (PluginProcessCreationParameters): 65 * UIProcess/Launcher/ProcessLauncher.h: 66 (LaunchOptions): 67 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 68 (WebKit::connectToService): 69 (WebKit::connectToReExecService): 70 (WebKit::createService): 71 (WebKit::createProcess): 72 (WebKit::ProcessLauncher::launchProcess): 73 * UIProcess/Plugins/PluginProcessProxy.cpp: 74 (WebKit::PluginProcessProxy::didFinishLaunching): 75 * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: 76 (WebKit::PluginProcessProxy::platformInitializeLaunchOptions): 77 (WebKit::PluginProcessProxy::platformInitializePluginProcess): 78 * WebKit2.xcodeproj/project.pbxproj: 79 * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm: 80 * WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm: 81 * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm: 82 (WebContentServiceInitializer): 83 1 84 2013-01-28 Kiran Muppala <cmuppala@apple.com> 2 85 -
trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm
r140924 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializeNetworkService26 #define WEBKIT_XPC_SERVICE_INITIALIZER NetworkServiceInitializer 27 27 #include "XPCServiceBootstrapper.Development.h" 28 28 -
trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm
r140924 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializeNetworkService26 #define WEBKIT_XPC_SERVICE_INITIALIZER NetworkServiceInitializer 27 27 #include "XPCServiceBootstrapper.h" 28 28 -
trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm
r140924 r141051 29 29 30 30 #import "EnvironmentUtilities.h" 31 #import "NetworkProcess.h" 31 32 #import "WKBase.h" 32 #import "WebKit2Initialize.h" 33 #import "NetworkProcess.h" 34 #import <WebCore/RunLoop.h> 35 #import <stdio.h> 36 #import <stdlib.h> 37 #import <xpc/xpc.h> 33 #import "XPCServiceEntryPoint.h" 38 34 39 using namespace WebCore;40 35 using namespace WebKit; 41 36 42 extern "C" WK_EXPORT void initializeNetworkService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);37 extern "C" WK_EXPORT void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage); 43 38 44 void initializeNetworkService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)39 void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage) 45 40 { 46 // Remove the SecItemShim shimfrom the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by41 // Remove the SecItemShim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by 47 42 // the this process don't try to insert the shim and crash. 48 43 EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib"); 49 44 50 InitializeWebKit2(); 51 52 ChildProcessInitializationParameters parameters; 53 parameters.uiProcessName = uiProcessName; 54 parameters.clientIdentifier = clientIdentifier; 55 parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection); 56 57 NetworkProcess::shared().initialize(parameters); 45 XPCServiceInitializer<NetworkProcess, XPCServiceInitializerDelegate>(connection, initializerMessage); 58 46 } 59 47 -
trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm
r140915 r141051 81 81 } 82 82 83 virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData) 84 { 85 String pluginPath = m_commandLine["plugin-path"]; 86 if (pluginPath.isEmpty()) 87 return false; 88 extraInitializationData.add("plugin-path", pluginPath); 89 90 // FIXME: We should stop passing this and have it in a hard coded place. For now 91 // though, let the absence of a sandboxProfileDirectoryPath indicate no plugin 92 // sandboxing should take place. 93 String sandboxProfileDirectoryPath = m_commandLine["sandbox-profile-directory-path"]; 94 extraInitializationData.add("sandbox-profile-directory-path", sandboxProfileDirectoryPath); 95 96 return true; 97 } 98 83 99 virtual void doPostRunWork() 84 100 { -
trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm
r140929 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService 26 #if defined(__i386__) 27 28 #define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer 27 29 #include "XPCServiceBootstrapper.h" 28 30 … … 34 36 return 0; 35 37 } 38 39 #else 40 41 int main(int argc, char** argv) 42 { 43 return 0; 44 } 45 46 #endif -
trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm
r140929 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService26 #define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer 27 27 #include "XPCServiceBootstrapper.h" 28 28 -
trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm
r140929 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService26 #define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer 27 27 #include "XPCServiceBootstrapper.Development.h" 28 28 -
trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
r140929 r141051 29 29 30 30 #import "EnvironmentUtilities.h" 31 #import "PluginProcess.h" 31 32 #import "WKBase.h" 32 #import "WebKit2Initialize.h" 33 #import "PluginProcess.h" 33 #import "XPCServiceEntryPoint.h" 34 34 #import <WebCore/RunLoop.h> 35 #import <xpc/xpc.h> 35 36 namespace WebKit { 37 38 class PluginServiceInitializerDelegate : public XPCServiceInitializerDelegate { 39 public: 40 PluginServiceInitializerDelegate(xpc_connection_t connection, xpc_object_t initializerMessage) 41 : XPCServiceInitializerDelegate(connection, initializerMessage) 42 { 43 } 44 45 virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData) 46 { 47 xpc_object_t extraDataInitializationDataObject = xpc_dictionary_get_value(m_initializerMessage, "extra-initialization-data"); 48 49 String pluginPath = xpc_dictionary_get_string(extraDataInitializationDataObject, "plugin-path"); 50 if (pluginPath.isEmpty()) 51 return false; 52 extraInitializationData.add("plugin-path", pluginPath); 53 54 // FIXME: We should stop passing this and have it in a hard coded place. For now 55 // though, let the absence of a sandboxProfileDirectoryPath indicate no plugin 56 // sandboxing should take place. 57 String sandboxProfileDirectoryPath = xpc_dictionary_get_string(extraDataInitializationDataObject, "sandbox-profile-directory-path"); 58 extraInitializationData.add("sandbox-profile-directory-path", sandboxProfileDirectoryPath); 59 60 return true; 61 } 62 }; 63 64 } // namespace WebKit 36 65 37 66 using namespace WebCore; 38 67 using namespace WebKit; 39 68 40 extern "C" WK_EXPORT void initializePluginService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);69 extern "C" WK_EXPORT void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage); 41 70 42 void initializePluginService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)71 void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage) 43 72 { 73 // FIXME: Add support for teardown from PluginProcessMain.mm 74 44 75 // Remove the PluginProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes 45 76 // spawned by the PluginProcess don't try to insert the shim and crash. 46 77 EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib"); 78 RunLoop::setUseApplicationRunLoopOnMainRunLoop(); 47 79 48 RunLoop::setUseApplicationRunLoopOnMainRunLoop(); 49 InitializeWebKit2(); 50 51 ChildProcessInitializationParameters parameters; 52 parameters.uiProcessName = uiProcessName; 53 parameters.clientIdentifier = clientIdentifier; 54 parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection); 55 56 PluginProcess::shared().initialize(parameters); 57 58 // FIXME: Add support for teardown from PluginProcessMain.mm 80 XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(connection, initializerMessage); 59 81 } 60 82 -
trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp
r140926 r141051 88 88 void PluginProcess::initializeProcess(const ChildProcessInitializationParameters& parameters) 89 89 { 90 m_pluginPath = parameters.extraInitializationData.get("plugin-path"); 90 91 platformInitializeProcess(parameters); 91 92 } 92 93 #if !PLATFORM(MAC)94 void PluginProcess::enterSandbox(const String&)95 {96 }97 #endif98 93 99 94 void PluginProcess::removeWebProcessConnection(WebProcessConnection* webProcessConnection) … … 156 151 ASSERT(!m_pluginModule); 157 152 158 m_pluginPath = parameters.pluginPath;159 153 m_supportsAsynchronousPluginInitialization = parameters.supportsAsynchronousPluginInitialization; 160 154 setMinimumLifetime(parameters.minimumLifetime); … … 265 259 } 266 260 261 #if !PLATFORM(MAC) 262 void PluginProcess::initializeProcessName(const ChildProcessInitializationParameters&) 263 { 264 } 265 266 void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) 267 { 268 } 269 #endif 270 267 271 } // namespace WebKit 268 272 -
trunk/Source/WebKit2/PluginProcess/PluginProcess.h
r140926 r141051 32 32 #include <wtf/Forward.h> 33 33 #include <wtf/text/WTFString.h> 34 35 namespace WebCore {36 class RunLoop;37 }38 34 39 35 namespace WebKit { … … 73 69 ~PluginProcess(); 74 70 75 void enterSandbox(const String& sandboxProfileDirectoryPath);76 77 71 // ChildProcess 78 72 virtual void initializeProcess(const ChildProcessInitializationParameters&) OVERRIDE; 73 virtual void initializeProcessName(const ChildProcessInitializationParameters&) OVERRIDE; 74 virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) OVERRIDE; 79 75 virtual bool shouldTerminate() OVERRIDE; 80 81 // Prevent entering the sandbox during first stage of process initialization. We can't do enter the sandbox before receiving82 // sandbox profile directory in initialization message.83 virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) OVERRIDE { }84 85 76 void platformInitializeProcess(const ChildProcessInitializationParameters&); 86 77 … … 101 92 void setMinimumLifetime(double); 102 93 void minimumLifetimeTimerFired(); 103 104 // Stored for delayed sandbox initialization.105 ChildProcessInitializationParameters m_childProcessInitializationParameters;106 107 94 // Our web process connections. 108 95 Vector<RefPtr<WebProcessConnection> > m_webProcessConnections; -
trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
r140926 r141051 271 271 } 272 272 273 void PluginProcess::setModalWindowIsShowing(bool modalWindowIsShowing) 274 { 275 parentProcessConnection()->send(Messages::PluginProcessProxy::SetModalWindowIsShowing(modalWindowIsShowing), 0); 276 } 277 278 void PluginProcess::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) 279 { 280 parentProcessConnection()->send(Messages::PluginProcessProxy::SetFullscreenWindowIsShowing(fullscreenWindowIsShowing), 0); 281 } 282 283 static String loadSandboxProfile(const String& pluginPath, const String& sandboxProfileDirectoryPath) 284 { 285 if (sandboxProfileDirectoryPath.isEmpty()) 286 return String(); 287 288 RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); 289 if (!pluginURL) 290 return String(); 291 292 RetainPtr<CFBundleRef> pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); 293 if (!pluginBundle) 294 return String(); 295 296 CFStringRef bundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); 297 if (!bundleIdentifier) 298 return String(); 299 300 RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, sandboxProfileDirectoryPath.createCFString().get(), kCFURLPOSIXPathStyle, TRUE)); 301 302 RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); 303 RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); 304 305 RetainPtr<NSString> profileString = adoptNS([[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]); 306 if (!profileString) 307 return String(); 308 309 sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, CFSTR("com.apple.WebKit.plugin-common.sb"), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); 310 311 RetainPtr<NSString> commonProfileString = adoptNS([[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]); 312 if (!commonProfileString) 313 return String(); 314 315 return [commonProfileString.get() stringByAppendingString:profileString.get()]; 316 } 317 318 static void muteAudio(void) 319 { 320 AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; 321 UInt32 propertyData = 0; 322 OSStatus result = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, 0, sizeof(UInt32), &propertyData); 323 ASSERT_UNUSED(result, result == noErr); 324 } 325 326 void PluginProcess::platformInitializePluginProcess(const PluginProcessCreationParameters& parameters) 327 { 328 m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); 329 if (parameters.processType == TypeSnapshotProcess) 330 muteAudio(); 331 } 332 273 333 void PluginProcess::platformInitializeProcess(const ChildProcessInitializationParameters& parameters) 274 334 { 275 m_childProcessInitializationParameters = parameters;276 277 RunLoop::setUseApplicationRunLoopOnMainRunLoop();278 279 335 #if defined(__i386__) 280 336 // Initialize the shim. … … 296 352 } 297 353 298 void PluginProcess::setModalWindowIsShowing(bool modalWindowIsShowing) 299 { 300 parentProcessConnection()->send(Messages::PluginProcessProxy::SetModalWindowIsShowing(modalWindowIsShowing), 0); 301 } 302 303 void PluginProcess::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) 304 { 305 parentProcessConnection()->send(Messages::PluginProcessProxy::SetFullscreenWindowIsShowing(fullscreenWindowIsShowing), 0); 306 } 307 308 static String loadSandboxProfile(const String& pluginPath, const String& sandboxProfileDirectoryPath) 309 { 310 if (sandboxProfileDirectoryPath.isEmpty()) 311 return String(); 312 313 RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); 314 if (!pluginURL) 315 return String(); 316 317 RetainPtr<CFBundleRef> pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); 318 if (!pluginBundle) 319 return String(); 320 321 CFStringRef bundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); 322 if (!bundleIdentifier) 323 return String(); 324 325 RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, sandboxProfileDirectoryPath.createCFString().get(), kCFURLPOSIXPathStyle, TRUE)); 326 327 RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); 328 RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); 329 330 RetainPtr<NSString> profileString = adoptNS([[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]); 331 if (!profileString) 332 return String(); 333 334 sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, CFSTR("com.apple.WebKit.plugin-common.sb"), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); 335 336 RetainPtr<NSString> commonProfileString = adoptNS([[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]); 337 if (!commonProfileString) 338 return String(); 339 340 return [commonProfileString.get() stringByAppendingString:profileString.get()]; 341 } 342 343 static void muteAudio(void) 344 { 345 AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; 346 UInt32 propertyData = 0; 347 OSStatus result = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, 0, sizeof(UInt32), &propertyData); 348 ASSERT_UNUSED(result, result == noErr); 349 } 350 351 void PluginProcess::platformInitializePluginProcess(const PluginProcessCreationParameters& parameters) 352 { 353 m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); 354 355 NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)", 356 "visible name of the plug-in host process. The first argument is the plug-in name " 357 "and the second argument is the application name."), 358 [[(NSString *)parameters.pluginPath lastPathComponent] stringByDeletingPathExtension], 359 (NSString *)parameters.parentProcessName]; 360 354 void PluginProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters) 355 { 356 NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name and the second argument is the application name."), [[(NSString *)m_pluginPath lastPathComponent] stringByDeletingPathExtension], (NSString *)parameters.uiProcessName]; 361 357 WKSetVisibleApplicationName((CFStringRef)applicationName); 362 363 // FIXME: PluginProcess initializes sandbox later than normal for ChildProcesses, because it needs 364 // to know profile directory path. Switch to normal initialization scheme once the path can be determined earlier. 365 enterSandbox(parameters.sandboxProfileDirectoryPath); 366 367 if (parameters.processType == TypeSnapshotProcess) 368 muteAudio(); 369 } 370 371 void PluginProcess::enterSandbox(const String& sandboxProfileDirectoryPath) 372 { 373 SandboxInitializationParameters sandboxParameters; 374 375 String sandboxProfile = loadSandboxProfile(m_pluginPath, sandboxProfileDirectoryPath); 358 } 359 360 void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters) 361 { 362 String sandboxProfile = loadSandboxProfile(m_pluginPath, parameters.extraInitializationData.get("sandbox-profile-directory-path")); 376 363 if (sandboxProfile.isEmpty()) 377 364 return; … … 404 391 [[NSUserDefaults standardUserDefaults] registerDefaults:defaults.get()]; 405 392 406 ChildProcess::initializeSandbox( m_childProcessInitializationParameters, sandboxParameters);393 ChildProcess::initializeSandbox(parameters, sandboxParameters); 407 394 } 408 395 -
trunk/Source/WebKit2/Shared/ChildProcess.h
r140730 r141051 31 31 #include "MessageSender.h" 32 32 #include <WebCore/RunLoop.h> 33 #include <wtf/HashMap.h> 33 34 #include <wtf/RetainPtr.h> 35 #include <wtf/text/StringHash.h> 34 36 #include <wtf/text/WTFString.h> 35 37 … … 42 44 String clientIdentifier; 43 45 CoreIPC::Connection::Identifier connectionIdentifier; 46 HashMap<String, String> extraInitializationData; 44 47 }; 45 48 -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h
r140915 r141051 51 51 virtual bool getClientIdentifier(String& clientIdentifier); 52 52 virtual bool getClientProcessName(String& clientProcessName); 53 virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData); 53 54 54 55 virtual void doPostRunWork(); … … 83 84 return EXIT_FAILURE; 84 85 86 if (!delegate.getExtraInitializationData(parameters.extraInitializationData)) 87 return EXIT_FAILURE; 88 85 89 // FIXME: This should be moved to ChildProcessMac if it is still necessary. 86 90 String localization = commandLine["localization"]; -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm
r140914 r141051 89 89 } 90 90 91 bool ChildProcessMainDelegate::getExtraInitializationData(HashMap<String, String>&) 92 { 93 return true; 94 } 95 91 96 void ChildProcessMainDelegate::doPostRunWork() 92 97 { -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h
r140922 r141051 31 31 #endif 32 32 33 #import <AvailabilityMacros.h>34 33 #import <crt_externs.h> 35 34 #import <dlfcn.h> … … 39 38 #import <stdlib.h> 40 39 #import <xpc/xpc.h> 41 42 extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);43 40 44 41 #define STRINGIZE(exp) #exp … … 118 115 } 119 116 120 typedef void (*InitializerFunction)( const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);117 typedef void (*InitializerFunction)(xpc_connection_t, xpc_object_t); 121 118 InitializerFunction initializerFunctionPtr = reinterpret_cast<InitializerFunction>(dlsym(frameworkLibrary, STRINGIZE_VALUE_OF(WEBKIT_XPC_SERVICE_INITIALIZER))); 122 119 if (!initializerFunctionPtr) { … … 133 130 dup2(xpc_dictionary_dup_fd(event, "stderr"), STDERR_FILENO); 134 131 135 initializerFunctionPtr( 136 xpc_dictionary_get_string(event, "client-identifier"), 137 peer, 138 xpc_dictionary_copy_mach_send(event, "server-port"), 139 xpc_dictionary_get_string(event, "ui-process-name") 140 ); 132 initializerFunctionPtr(peer, event); 141 133 } 142 134 } -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h
r140919 r141051 32 32 33 33 #import <xpc/xpc.h> 34 extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);35 34 36 35 // Forward declare the specified initializer. 37 extern "C" void WEBKIT_XPC_SERVICE_INITIALIZER( const char* clientIdentifier, xpc_connection_t, mach_port_t serverPort, const char* uiProcessName);36 extern "C" void WEBKIT_XPC_SERVICE_INITIALIZER(xpc_connection_t, xpc_object_t); 38 37 39 38 namespace WebKit { … … 58 57 xpc_release(reply); 59 58 60 WEBKIT_XPC_SERVICE_INITIALIZER( 61 xpc_dictionary_get_string(event, "client-identifier"), 62 peer, 63 xpc_dictionary_copy_mach_send(event, "server-port"), 64 xpc_dictionary_get_string(event, "ui-process-name") 65 ); 59 WEBKIT_XPC_SERVICE_INITIALIZER(peer, event); 66 60 } 67 61 } -
trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
r136193 r141051 40 40 void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const 41 41 { 42 encoder << pluginPath;43 42 encoder.encodeEnum(processType); 44 43 encoder << supportsAsynchronousPluginInitialization; 45 44 encoder << minimumLifetime; 46 45 encoder << terminationTimeout; 47 48 46 #if PLATFORM(MAC) 49 encoder << parentProcessName;50 47 encoder << acceleratedCompositingPort; 51 encoder << sandboxProfileDirectoryPath;52 48 #endif 53 49 } … … 55 51 bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginProcessCreationParameters& result) 56 52 { 57 if (!decoder->decode(result.pluginPath))58 return false;59 53 if (!decoder->decodeEnum(result.processType)) 60 54 return false; … … 66 60 return false; 67 61 #if PLATFORM(MAC) 68 if (!decoder->decode(result.parentProcessName))69 return false;70 62 if (!decoder->decode(result.acceleratedCompositingPort)) 71 return false;72 if (!decoder->decode(result.sandboxProfileDirectoryPath))73 63 return false; 74 64 #endif -
trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
r136193 r141051 30 30 31 31 #include "PluginProcess.h" 32 #include <wtf/text/WTFString.h>33 32 34 33 #if PLATFORM(MAC) … … 49 48 static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&); 50 49 51 String pluginPath;52 50 PluginProcess::Type processType; 53 51 bool supportsAsynchronousPluginInitialization; … … 57 55 58 56 #if PLATFORM(MAC) 59 String parentProcessName;60 57 CoreIPC::MachPort acceleratedCompositingPort; 61 String sandboxProfileDirectoryPath;62 58 #endif 63 59 }; -
trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
r132974 r141051 29 29 #include "Connection.h" 30 30 #include "PlatformProcessIdentifier.h" 31 #include <wtf/HashMap.h> 31 32 #include <wtf/RefPtr.h> 32 33 #include <wtf/Threading.h> 33 34 #ifndef NDEBUG 34 #include <wtf/text/StringHash.h> 35 35 #include <wtf/text/WTFString.h> 36 #endif37 36 38 37 namespace WebKit { … … 62 61 struct LaunchOptions { 63 62 ProcessType processType; 63 HashMap<String, String> extraInitializationData; 64 64 #if PLATFORM(MAC) 65 65 static const cpu_type_t MatchCurrentArchitecture = 0; -
trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r140929 r141051 179 179 } 180 180 181 static void connectToService ForDevelopment(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID)181 static void connectToService(const ProcessLauncher::LaunchOptions& launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID) 182 182 { 183 183 // Create a connection to the WebKit2 XPC service. 184 xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, true), 0);184 xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, forDevelopment), 0); 185 185 xpc_connection_set_instance(connection, instanceUUID->uuid); 186 186 … … 205 205 xpc_dictionary_set_string(bootstrapMessage, "client-identifier", clientIdentifier.data()); 206 206 xpc_dictionary_set_string(bootstrapMessage, "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]); 207 xpc_dictionary_set_fd(bootstrapMessage, "stdout", STDOUT_FILENO); 208 xpc_dictionary_set_fd(bootstrapMessage, "stderr", STDERR_FILENO); 207 208 if (forDevelopment) { 209 xpc_dictionary_set_fd(bootstrapMessage, "stdout", STDOUT_FILENO); 210 xpc_dictionary_set_fd(bootstrapMessage, "stderr", STDERR_FILENO); 211 } 212 213 xpc_object_t extraInitializationData = xpc_dictionary_create(0, 0, 0); 214 HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin(); 215 HashMap<String, String>::const_iterator end = launchOptions.extraInitializationData.end(); 216 for (; it != end; ++it) 217 xpc_dictionary_set_string(extraInitializationData, it->key.utf8().data(), it->value.utf8().data()); 218 xpc_dictionary_set_value(bootstrapMessage, "extra-initialization-data", extraInitializationData); 219 xpc_release(extraInitializationData); 209 220 210 221 that->ref(); … … 236 247 } 237 248 238 static void c reateServiceForDevelopment(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)249 static void connectToReExecService(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) 239 250 { 240 251 EnvironmentVariables environmentVariables; … … 257 268 ASSERT(xpc_get_type(event) == XPC_TYPE_ERROR); 258 269 259 connectToService ForDevelopment(launchOptions, that, didFinishLaunchingProcessFunction, instanceUUID.get());270 connectToService(launchOptions, true, that, didFinishLaunchingProcessFunction, instanceUUID.get()); 260 271 261 272 // Release the connection. … … 291 302 } 292 303 293 static void createService(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) 294 { 304 static void createService(const ProcessLauncher::LaunchOptions& launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction) 305 { 306 if (forDevelopment) { 307 connectToReExecService(launchOptions, that, didFinishLaunchingProcessFunction); 308 return; 309 } 310 295 311 // Generate the uuid for the service instance we are about to create. 296 312 // FIXME: This UUID should be stored on the ChildProcessProxy. 297 313 RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create(); 298 299 // Create a connection to the WebKit2 XPC service. 300 xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, false), 0); 301 xpc_connection_set_instance(connection, instanceUUID->uuid); 302 303 // XPC requires having an event handler, even if it is not used. 304 xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { }); 305 xpc_connection_resume(connection); 306 307 // Create the listening port. 308 mach_port_t listeningPort; 309 mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); 310 311 // Insert a send right so we can send to it. 312 mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); 313 314 NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; 315 CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); 316 317 xpc_object_t bootstrapMessage = xpc_dictionary_create(0, 0, 0); 318 xpc_dictionary_set_string(bootstrapMessage, "message-name", "bootstrap"); 319 xpc_dictionary_set_mach_send(bootstrapMessage, "server-port", listeningPort); 320 xpc_dictionary_set_string(bootstrapMessage, "client-identifier", clientIdentifier.data()); 321 xpc_dictionary_set_string(bootstrapMessage, "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]); 322 323 that->ref(); 324 325 xpc_connection_send_message_with_reply(connection, bootstrapMessage, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(xpc_object_t reply) { 326 xpc_type_t type = xpc_get_type(reply); 327 if (type == XPC_TYPE_ERROR) { 328 // We failed to launch. Release the send right. 329 mach_port_deallocate(mach_task_self(), listeningPort); 330 331 // And the receive right. 332 mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1); 333 334 RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, 0, CoreIPC::Connection::Identifier())); 335 } else { 336 ASSERT(type == XPC_TYPE_DICTIONARY); 337 ASSERT(!strcmp(xpc_dictionary_get_string(reply, "message-name"), "process-finished-launching")); 338 339 // The process has finished launching, grab the pid from the connection. 340 pid_t processIdentifier = xpc_connection_get_pid(connection); 341 342 // We've finished launching the process, message back to the main run loop. 343 RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, CoreIPC::Connection::Identifier(listeningPort, connection))); 344 } 345 346 that->deref(); 347 }); 348 xpc_release(bootstrapMessage); 349 } 314 connectToService(launchOptions, false, that, didFinishLaunchingProcessFunction, instanceUUID.get()); 315 } 316 350 317 #endif 351 318 … … 444 411 CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), that).utf8(); 445 412 446 const char* args[] = { [processAppExecutablePath fileSystemRepresentation], [frameworkExecutablePath fileSystemRepresentation], "-type", ProcessLauncher::processTypeAsString(launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), "-client-identifier", clientIdentifier.data(), 447 "-ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String], 0 }; 413 Vector<const char*> args; 414 args.append([processAppExecutablePath fileSystemRepresentation]); 415 args.append([frameworkExecutablePath fileSystemRepresentation]); 416 args.append("-type"); 417 args.append(ProcessLauncher::processTypeAsString(launchOptions.processType)); 418 args.append("-servicename"); 419 args.append(serviceName.data()); 420 args.append("-localization"); 421 args.append(localization.data()); 422 args.append("-client-identifier"); 423 args.append(clientIdentifier.data()); 424 args.append("-ui-process-name"); 425 args.append([[[NSProcessInfo processInfo] processName] UTF8String]); 426 427 HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin(); 428 HashMap<String, String>::const_iterator end = launchOptions.extraInitializationData.end(); 429 Vector<CString> temps; 430 for (; it != end; ++it) { 431 String keyPlusDash = "-" + it->key; 432 CString key(keyPlusDash.utf8().data()); 433 temps.append(key); 434 args.append(key.data()); 435 436 CString value(it->value.utf8().data()); 437 temps.append(value); 438 args.append(value.data()); 439 } 440 441 args.append(nullptr); 448 442 449 443 // Register ourselves. … … 482 476 483 477 pid_t processIdentifier = 0; 484 int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args ), environmentVariables.environmentPointer());478 int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args.data()), environmentVariables.environmentPointer()); 485 479 486 480 posix_spawnattr_destroy(&attr); … … 514 508 #if HAVE(XPC) 515 509 if (m_launchOptions.useXPC) { 516 if (isWebKitDevelopmentBuild) 517 createServiceForDevelopment(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess); 518 else 519 createService(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess); 510 createService(m_launchOptions, isWebKitDevelopmentBuild, this, &ProcessLauncher::didFinishLaunchingProcess); 520 511 return; 521 512 } -
trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
r139888 r141051 204 204 205 205 PluginProcessCreationParameters parameters; 206 207 parameters.pluginPath = m_pluginInfo.path;208 206 parameters.processType = m_processType; 209 210 207 parameters.minimumLifetime = minimumLifetime; 211 208 parameters.terminationTimeout = shutdownTimeout; 212 213 209 platformInitializePluginProcess(parameters); 214 210 -
trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
r140929 r141051 137 137 launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo); 138 138 139 #if HAVE(XPC) 140 launchOptions.useXPC = shouldUseXPC(); 141 #endif 142 } 143 144 void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters) 145 { 146 // For know only Flash is known to behave with asynchronous plug-in initialization. 147 parameters.supportsAsynchronousPluginInitialization = m_pluginInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin"; 148 149 #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) 150 parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; 151 mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort]; 152 153 if (renderServerPort != MACH_PORT_NULL) 154 parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND); 155 #endif 139 launchOptions.extraInitializationData.add("plugin-path", pluginInfo.path); 156 140 157 141 // FIXME: We should rip this out once we have a good place to install plug-in … … 159 143 NSString* sandboxProfileDirectoryPath = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2PlugInSandboxProfileDirectoryPathKey]; 160 144 if (sandboxProfileDirectoryPath) 161 parameters.sandboxProfileDirectoryPath = String(sandboxProfileDirectoryPath); 145 launchOptions.extraInitializationData.add("sandbox-profile-directory-path", String(sandboxProfileDirectoryPath)); 146 147 #if HAVE(XPC) 148 launchOptions.useXPC = shouldUseXPC(); 149 #endif 150 } 151 152 void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters) 153 { 154 // For now only Flash is known to behave with asynchronous plug-in initialization. 155 parameters.supportsAsynchronousPluginInitialization = m_pluginInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin"; 156 157 #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) 158 mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort]; 159 if (renderServerPort != MACH_PORT_NULL) 160 parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND); 161 #endif 162 162 } 163 163 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r141024 r141051 915 915 BCBD3C3B125BFA7A00D2C29F /* StringPairVector.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */; }; 916 916 BCBECDC316B5CEB100047A1A /* PluginService.Development.Main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBECDC116B5CE0D00047A1A /* PluginService.Development.Main.mm */; }; 917 BCBECDE716B6416800047A1A /* XPCServiceEntryPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */; }; 918 BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */; }; 917 919 BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */; }; 918 920 BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */; }; … … 2264 2266 BCBECDC116B5CE0D00047A1A /* PluginService.Development.Main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginService.Development.Main.mm; sourceTree = "<group>"; }; 2265 2267 BCBECDC216B5CE2A00047A1A /* PluginService.Development.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = PluginService.Development.xcconfig; sourceTree = "<group>"; }; 2268 BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XPCServiceEntryPoint.mm; sourceTree = "<group>"; }; 2269 BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCServiceEntryPoint.h; sourceTree = "<group>"; }; 2266 2270 BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformPopupMenuData.cpp; sourceTree = "<group>"; }; 2267 2271 BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformPopupMenuData.h; sourceTree = "<group>"; }; … … 4178 4182 isa = PBXGroup; 4179 4183 children = ( 4184 BC82839716B480F600A278FE /* XPCServiceBootstrapper.Development.h */, 4180 4185 BC82839616B47EC400A278FE /* XPCServiceBootstrapper.h */, 4181 BC82839716B480F600A278FE /* XPCServiceBootstrapper.Development.h */, 4186 BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */, 4187 BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */, 4182 4188 ); 4183 4189 name = XPCService; … … 5321 5327 518E8F0C16B2093700E91429 /* DownloadManager.h in Headers */, 5322 5328 BC82837A16B36A4F00A278FE /* ChildProcessMain.h in Headers */, 5329 BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */, 5323 5330 A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */, 5324 5331 ); … … 6437 6444 BC8283AC16B4BF3F00A278FE /* NetworkServiceEntryPoint.mm in Sources */, 6438 6445 BC82844D16B5081C00A278FE /* PluginServiceEntryPoint.mm in Sources */, 6446 BCBECDE716B6416800047A1A /* XPCServiceEntryPoint.mm in Sources */, 6439 6447 ); 6440 6448 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm
r140919 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializeWebContentService26 #define WEBKIT_XPC_SERVICE_INITIALIZER WebContentServiceInitializer 27 27 #include "XPCServiceBootstrapper.Development.h" 28 28 -
trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm
r140919 r141051 24 24 */ 25 25 26 #define WEBKIT_XPC_SERVICE_INITIALIZER initializeWebContentService26 #define WEBKIT_XPC_SERVICE_INITIALIZER WebContentServiceInitializer 27 27 #include "XPCServiceBootstrapper.h" 28 28 -
trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
r140924 r141051 30 30 #import "EnvironmentUtilities.h" 31 31 #import "WKBase.h" 32 #import "WebKit2Initialize.h"33 32 #import "WebProcess.h" 33 #import "XPCServiceEntryPoint.h" 34 34 #import <WebCore/RunLoop.h> 35 #import <stdio.h>36 #import <stdlib.h>37 #import <xpc/xpc.h>38 35 39 36 using namespace WebCore; 40 37 using namespace WebKit; 41 38 42 extern "C" WK_EXPORT void initializeWebContentService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);39 extern "C" WK_EXPORT void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage); 43 40 44 void initializeWebContentService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)41 void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage) 45 42 { 46 // Remove the SecItemShim shimfrom the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by43 // Remove the SecItemShim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by 47 44 // the this process don't try to insert the shim and crash. 48 45 EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib"); 49 46 50 47 RunLoop::setUseApplicationRunLoopOnMainRunLoop(); 51 InitializeWebKit2();52 48 53 ChildProcessInitializationParameters parameters; 54 parameters.uiProcessName = uiProcessName; 55 parameters.clientIdentifier = clientIdentifier; 56 parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection); 57 58 WebProcess::shared().initialize(parameters); 49 XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(connection, initializerMessage); 59 50 } 60 51
Note: See TracChangeset
for help on using the changeset viewer.