Title: [184125] trunk/Source/WebKit2
- Revision
- 184125
- Author
- [email protected]
- Date
- 2015-05-11 15:31:33 -0700 (Mon, 11 May 2015)
Log Message
Simplify shim path computation
https://bugs.webkit.org/show_bug.cgi?id=144884
Part of rdar://problem/19708579.
Reviewed by Sam Weinig.
Factor the code that computes the shim path out into a separate function. Also make this mac only
since we don't have any shims on iOS.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::computeProcessShimPath):
(WebKit::addDYLDEnvironmentAdditions):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (184124 => 184125)
--- trunk/Source/WebKit2/ChangeLog 2015-05-11 21:40:52 UTC (rev 184124)
+++ trunk/Source/WebKit2/ChangeLog 2015-05-11 22:31:33 UTC (rev 184125)
@@ -1,3 +1,18 @@
+2015-05-11 Anders Carlsson <[email protected]>
+
+ Simplify shim path computation
+ https://bugs.webkit.org/show_bug.cgi?id=144884
+ Part of rdar://problem/19708579.
+
+ Reviewed by Sam Weinig.
+
+ Factor the code that computes the shim path out into a separate function. Also make this mac only
+ since we don't have any shims on iOS.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::computeProcessShimPath):
+ (WebKit::addDYLDEnvironmentAdditions):
+
2015-05-11 Myles C. Maxfield <[email protected]>
Unreviewed build fix
Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (184124 => 184125)
--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-05-11 21:40:52 UTC (rev 184124)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-05-11 22:31:33 UTC (rev 184125)
@@ -93,44 +93,52 @@
}
#endif
-static void addDYLDEnvironmentAdditions(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, EnvironmentVariables& environmentVariables)
+#if PLATFORM(MAC)
+static RetainPtr<NSString> computeProcessShimPath(const ProcessLauncher::LaunchOptions& launchOptions, NSBundle *webKitBundle)
{
- DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype);
- environmentExtractor.getExtractedEnvironmentVariables(environmentVariables);
-
- NSBundle *webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
- NSString *frameworksPath = [[webKitBundle bundlePath] stringByDeletingLastPathComponent];
-
- // To make engineering builds work, if the path is outside of /System set up
- // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the
- // production configuration because it involves extra file system access.
- if (isWebKitDevelopmentBuild)
- environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':');
-
- NSString *processShimPathNSString = nil;
#if ENABLE(NETSCAPE_PLUGIN_API)
if (launchOptions.processType == ProcessLauncher::PluginProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"PluginProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
- } else
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
+ }
+#endif
+
#if ENABLE(NETWORK_PROCESS)
if (launchOptions.processType == ProcessLauncher::NetworkProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"NetworkProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"SecItemShim.dylib"];
- } else
-#endif // ENABLE(NETWORK_PROCESS)
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"SecItemShim.dylib"];
+ }
+#endif
+
if (launchOptions.processType == ProcessLauncher::WebProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"WebProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"];
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"];
}
+ return nil;
+}
+#endif
+
+static void addDYLDEnvironmentAdditions(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, EnvironmentVariables& environmentVariables)
+{
+ DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype);
+ environmentExtractor.getExtractedEnvironmentVariables(environmentVariables);
+
+ NSBundle *webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
+ NSString *frameworksPath = [[webKitBundle bundlePath] stringByDeletingLastPathComponent];
+
+ // To make engineering builds work, if the path is outside of /System set up
+ // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the
+ // production configuration because it involves extra file system access.
+ if (isWebKitDevelopmentBuild)
+ environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':');
+
#if ASAN_ENABLED
static const char* asanLibraryPath = copyASanDynamicLibraryPath();
ASSERT(asanLibraryPath); // ASan runtime library was not found in the current process. This code may need to be updated if the library name has changed.
@@ -139,14 +147,15 @@
environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", asanLibraryPath, ':');
#endif
- // Make sure that the shim library file exists and insert it.
- if (processShimPathNSString) {
- const char* processShimPath = [processShimPathNSString fileSystemRepresentation];
+#if PLATFORM(MAC)
+ if (auto shimPath = computeProcessShimPath(launchOptions, webKitBundle)) {
+ // Make sure that the shim library file exists and insert it.
+ const char* processShimPath = [shimPath fileSystemRepresentation];
struct stat statBuf;
if (stat(processShimPath, &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG)
environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", processShimPath, ':');
}
-
+#endif
}
typedef void (ProcessLauncher::*DidFinishLaunchingProcessFunction)(PlatformProcessIdentifier, IPC::Connection::Identifier);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes