Reviewed by Dan Bernstein.
Plug-in hosting WebProcess instances appear in Activity Monitor as WebProcess
https://bugs.webkit.org/show_bug.cgi?id=52635
<rdar://problem/
8731337>
* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::initialize):
Call platformInitialize.
* PluginProcess/PluginProcess.h:
Add platformInitialize.
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitialize):
Set the compositing render server port and the visible application name.
* Shared/Plugins/PluginProcessCreationParameters.cpp:
(WebKit::PluginProcessCreationParameters::encode):
(WebKit::PluginProcessCreationParameters::decode):
Encode/decode the parent process name.
* Shared/Plugins/PluginProcessCreationParameters.h:
Add parentProcessName.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
Encode/decode the parent process name.
* Shared/WebProcessCreationParameters.h:
Add parentProcessName.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
Don't pass the parent process name here.
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::platformInitializePluginProcess):
Set the visible name.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess):
Pass along the parent process name.
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Set the visible name.
* WebProcess/mac/WebProcessMainMac.mm:
(WebKit::WebProcessMain):
Don't set the visible name here. It's done in platformInitializeWebProcess.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76034
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-01-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Plug-in hosting WebProcess instances appear in Activity Monitor as WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=52635
+ <rdar://problem/8731337>
+
+ * PluginProcess/PluginProcess.cpp:
+ (WebKit::PluginProcess::initialize):
+ Call platformInitialize.
+
+ * PluginProcess/PluginProcess.h:
+ Add platformInitialize.
+
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::PluginProcess::platformInitialize):
+ Set the compositing render server port and the visible application name.
+
+ * Shared/Plugins/PluginProcessCreationParameters.cpp:
+ (WebKit::PluginProcessCreationParameters::encode):
+ (WebKit::PluginProcessCreationParameters::decode):
+ Encode/decode the parent process name.
+
+ * Shared/Plugins/PluginProcessCreationParameters.h:
+ Add parentProcessName.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode):
+ (WebKit::WebProcessCreationParameters::decode):
+ Encode/decode the parent process name.
+
+ * Shared/WebProcessCreationParameters.h:
+ Add parentProcessName.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::ProcessLauncher::launchProcess):
+ Don't pass the parent process name here.
+
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::platformInitializePluginProcess):
+ Set the visible name.
+
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformInitializeWebProcess):
+ Pass along the parent process name.
+
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ Set the visible name.
+
+ * WebProcess/mac/WebProcessMainMac.mm:
+ (WebKit::WebProcessMain):
+ Don't set the visible name here. It's done in platformInitializeWebProcess.
+
2011-01-18 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Csaba Osztrogonác.
m_pluginPath = parameters.pluginPath;
-#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
- m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
-#endif
+ platformInitialize(parameters);
}
void PluginProcess::createWebProcessConnection()
void shutdownTimerFired();
+ void platformInitialize(const PluginProcessCreationParameters&);
+
// The connection to the UI process.
RefPtr<CoreIPC::Connection> m_connection;
*/
#if ENABLE(PLUGIN_PROCESS)
+
+// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
+#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str]
#include "PluginProcess.h"
#include "NetscapePlugin.h"
#include "PluginProcessShim.h"
+#include "PluginProcessCreationParameters.h"
+#include <WebKitSystemInterface.h>
#include <dlfcn.h>
namespace WebKit {
initFunc(callbacks);
}
+void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters)
+{
+ m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
+
+ NSString *applicationName = [NSString stringWithFormat: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 *)parameters.pluginPath lastPathComponent] stringByDeletingPathExtension],
+ (NSString *)parameters.parentProcessName];
+
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+}
+
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
encoder->encode(pluginPath);
#if PLATFORM(MAC)
+ encoder->encode(parentProcessName);
encoder->encode(acceleratedCompositingPort);
#endif
}
return false;
#if PLATFORM(MAC)
+ if (!decoder->decode(result.parentProcessName))
+ return false;
if (!decoder->decode(result.acceleratedCompositingPort))
return false;
#endif
String pluginPath;
#if PLATFORM(MAC)
+ String parentProcessName;
CoreIPC::MachPort acceleratedCompositingPort;
#endif
};
encoder->encode(languageCode);
encoder->encode(textCheckerState);
#if PLATFORM(MAC)
+ encoder->encode(parentProcessName);
encoder->encode(presenterApplicationPid);
encoder->encode(nsURLCachePath);
encoder->encode(nsURLCacheMemoryCapacity);
return false;
#if PLATFORM(MAC)
+ if (!decoder->decode(parameters.parentProcessName))
+ return false;
if (!decoder->decode(parameters.presenterApplicationPid))
return false;
if (!decoder->decode(parameters.nsURLCachePath))
TextCheckerState textCheckerState;
#if PLATFORM(MAC)
+ String parentProcessName;
+
pid_t presenterApplicationPid;
CString nsURLCachePath;
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
-
static void setUpTerminationNotificationHandler(pid_t pid)
{
#if HAVE(DISPATCH_H)
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
- const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
+ const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), 0 };
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
+ parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
mach_port_t renderServerPort = WKInitializeRenderServer();
if (renderServerPort != MACH_PORT_NULL)
parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND);
cachePath = reinterpret_cast<CFStringRef>(NSHomeDirectory());
NSURLCache *urlCache = [NSURLCache sharedURLCache];
-
+
+ parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
parameters.nsURLCachePath = fileSystemRepresentation([(NSString *)cachePath.get() stringByStandardizingPath]);
parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
{
initializeSandbox(parameters);
+ if (!parameters.parentProcessName.isNull()) {
+ // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
+ NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parameters.parentProcessName];
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+ }
+
if (!parameters.nsURLCachePath.isNull()) {
NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity;
NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity;
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());