https://bugs.webkit.org/show_bug.cgi?id=45564
<rdar://problem/8416970>
Reviewed by Mark Rowe and Darin Adler.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::processName):
Add a thread safe implementation of -[NSProcessInfo processName].
(WebKit::ProcessLauncher::launchProcess):
Pass the process name to the child process.
* WebProcess/mac/WebProcessMainMac.mm:
(WebKit::WebProcessMain):
Set the visible name.
WebKitLibraries: WebKitSystemInterface part of:
Set the visible name for the web process
https://bugs.webkit.org/show_bug.cgi?id=45564
<rdar://problem/8416970>
* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@67247
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-09-10 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Mark Rowe and Darin Adler.
+
+ Set the visible name for the web process
+ https://bugs.webkit.org/show_bug.cgi?id=45564
+ <rdar://problem/8416970>
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::processName):
+ Add a thread safe implementation of -[NSProcessInfo processName].
+
+ (WebKit::ProcessLauncher::launchProcess):
+ Pass the process name to the child process.
+
+ * WebProcess/mac/WebProcessMainMac.mm:
+ (WebKit::WebProcessMain):
+ Set the visible name.
+
2010-09-10 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
#include "WebProcess.h"
#include "WebSystemInterface.h"
#include <crt_externs.h>
+#include <mach-o/dyld.h>
#include <mach/machine.h>
#include <runtime/InitializeThreading.h>
#include <servers/bootstrap.h>
#include <spawn.h>
+#include <sys/param.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
#include <wtf/text/CString.h>
namespace WebKit {
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+static const char* processName()
+{
+ return [[[NSProcessInfo processInfo] processName] fileSystemRepresentation];
+}
+#else
+// -[NSProcessInfo processName] isn't thread-safe on Leopard and Snow Leopard so we have our own implementation.
+static const char* createProcessName()
+{
+ uint32_t bufferSize = MAXPATHLEN;
+ char executablePath[bufferSize];
+
+ if (_NSGetExecutablePath(executablePath, &bufferSize))
+ return "";
+
+ const char *processName = strrchr(executablePath, '/') + 1;
+ return strdup(processName);
+}
+
+static const char* processName()
+{
+ static const char* processName = createProcessName();
+ return processName;
+}
+#endif
+
void ProcessLauncher::launchProcess()
{
// Create the listening port.
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
- const char* args[] = { path, "-mode", "legacywebprocess", "-servicename", serviceName.data(), 0 };
+ const char* args[] = { path, "-mode", "legacywebprocess", "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
#import "WebProcess.h"
#import "WebSystemInterface.h"
#import <WebKit2/WKView.h>
+#import <WebKitSystemInterface.h>
#import <objc/objc-auto.h>
#import <runtime/InitializeThreading.h>
#import <servers/bootstrap.h>
#import <stdio.h>
#import <sysexits.h>
#import <unistd.h>
+#import <wtf/RetainPtr.h>
#import <wtf/Threading.h>
#import <wtf/text/CString.h>
printf("bootstrap_look_up2 result: %x", kr);
return 2;
}
-
#if !SHOW_CRASH_REPORTER
// Installs signal handlers that exit on a crash so that CrashReporter does not show up.
WTF::initializeMainThread();
RunLoop::initializeMainRunLoop();
+ // Set the visible application name.
+ String parentProcessName = (*commandLine)["parentprocessname"];
+ if (!parentProcessName.isNull()) {
+ // FIXME: Localization!
+ NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName];
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+ }
+
// Create the connection.
WebProcess::shared().initialize(serverPort, RunLoop::main());
+2010-09-10 Anders Carlsson <andersca@apple.com>
+
+ WebKitSystemInterface part of:
+ Set the visible name for the web process
+ https://bugs.webkit.org/show_bug.cgi?id=45564
+ <rdar://problem/8416970>
+
+ * WebKitSystemInterface.h:
+ * libWebKitSystemInterfaceLeopard.a:
+ * libWebKitSystemInterfaceSnowLeopard.a:
+
2010-08-05 Jian Li <jianli@chromium.org>
Reviewed by David Levin.
CFStringRef WKCopyFoundationCacheDirectory(void);
+void WKSetVisibleApplicationName(CFStringRef);
+
typedef enum {
WKMediaUIPartFullscreenButton = 0,
WKMediaUIPartMuteButton,