Changeset 76034 in webkit


Ignore:
Timestamp:
Jan 18, 2011 10:11:15 AM (13 years ago)
Author:
andersca@apple.com
Message:

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.
Location:
trunk/Source/WebKit2
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r76014 r76034  
     12011-01-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Plug-in hosting WebProcess instances appear in Activity Monitor as WebProcess
     6        https://bugs.webkit.org/show_bug.cgi?id=52635
     7        <rdar://problem/8731337>
     8
     9        * PluginProcess/PluginProcess.cpp:
     10        (WebKit::PluginProcess::initialize):
     11        Call platformInitialize.
     12
     13        * PluginProcess/PluginProcess.h:
     14        Add platformInitialize.
     15
     16        * PluginProcess/mac/PluginProcessMac.mm:
     17        (WebKit::PluginProcess::platformInitialize):
     18        Set the compositing render server port and the visible application name.
     19
     20        * Shared/Plugins/PluginProcessCreationParameters.cpp:
     21        (WebKit::PluginProcessCreationParameters::encode):
     22        (WebKit::PluginProcessCreationParameters::decode):
     23        Encode/decode the parent process name.
     24
     25        * Shared/Plugins/PluginProcessCreationParameters.h:
     26        Add parentProcessName.
     27
     28        * Shared/WebProcessCreationParameters.cpp:
     29        (WebKit::WebProcessCreationParameters::encode):
     30        (WebKit::WebProcessCreationParameters::decode):
     31        Encode/decode the parent process name.
     32
     33        * Shared/WebProcessCreationParameters.h:
     34        Add parentProcessName.
     35
     36        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
     37        (WebKit::ProcessLauncher::launchProcess):
     38        Don't pass the parent process name here.
     39
     40        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
     41        (WebKit::PluginProcessProxy::platformInitializePluginProcess):
     42        Set the visible name.
     43
     44        * UIProcess/mac/WebContextMac.mm:
     45        (WebKit::WebContext::platformInitializeWebProcess):
     46        Pass along the parent process name.
     47
     48        * WebProcess/mac/WebProcessMac.mm:
     49        (WebKit::WebProcess::platformInitializeWebProcess):
     50        Set the visible name.
     51
     52        * WebProcess/mac/WebProcessMainMac.mm:
     53        (WebKit::WebProcessMain):
     54        Don't set the visible name here. It's done in platformInitializeWebProcess.
     55
    1562011-01-18  Balazs Kelemen  <kbalazs@webkit.org>
    257
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp

    r74077 r76034  
    116116    m_pluginPath = parameters.pluginPath;
    117117
    118 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
    119     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
    120 #endif
     118    platformInitialize(parameters);
    121119}
    122120
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.h

    r73419 r76034  
    7373    void shutdownTimerFired();
    7474
     75    void platformInitialize(const PluginProcessCreationParameters&);
     76
    7577    // The connection to the UI process.
    7678    RefPtr<CoreIPC::Connection> m_connection;
  • trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm

    r73391 r76034  
    2525
    2626#if ENABLE(PLUGIN_PROCESS)
     27
     28// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
     29#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str]
    2730 
    2831#include "PluginProcess.h"
     
    3033#include "NetscapePlugin.h"
    3134#include "PluginProcessShim.h"
     35#include "PluginProcessCreationParameters.h"
     36#include <WebKitSystemInterface.h>
    3237#include <dlfcn.h>
    3338
     
    8590}
    8691
     92void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters)
     93{
     94    m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
     95
     96    NSString *applicationName = [NSString stringWithFormat:UI_STRING("%@ (%@ Internet plug-in)",
     97                                                                     "visible name of the plug-in host process. The first argument is the plug-in name "
     98                                                                     "and the second argument is the application name."),
     99                                 [[(NSString *)parameters.pluginPath lastPathComponent] stringByDeletingPathExtension],
     100                                 (NSString *)parameters.parentProcessName];
     101   
     102    WKSetVisibleApplicationName((CFStringRef)applicationName);
     103}
     104
    87105} // namespace WebKit
    88106
  • trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp

    r71247 r76034  
    4141
    4242#if PLATFORM(MAC)
     43    encoder->encode(parentProcessName);
    4344    encoder->encode(acceleratedCompositingPort);
    4445#endif
     
    5152
    5253#if PLATFORM(MAC)
     54    if (!decoder->decode(result.parentProcessName))
     55        return false;
    5356    if (!decoder->decode(result.acceleratedCompositingPort))
    5457        return false;
  • trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h

    r71247 r76034  
    5151
    5252#if PLATFORM(MAC)
     53    String parentProcessName;
    5354    CoreIPC::MachPort acceleratedCompositingPort;
    5455#endif
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp

    r75822 r76034  
    5757    encoder->encode(textCheckerState);
    5858#if PLATFORM(MAC)
     59    encoder->encode(parentProcessName);
    5960    encoder->encode(presenterApplicationPid);
    6061    encoder->encode(nsURLCachePath);
     
    9697
    9798#if PLATFORM(MAC)
     99    if (!decoder->decode(parameters.parentProcessName))
     100        return false;
    98101    if (!decoder->decode(parameters.presenterApplicationPid))
    99102        return false;
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h

    r75822 r76034  
    7474
    7575#if PLATFORM(MAC)
     76    String parentProcessName;
     77
    7678    pid_t presenterApplicationPid;
    7779    CString nsURLCachePath;
  • trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r74219 r76034  
    5050namespace WebKit {
    5151
    52 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    53 static const char* processName()
    54 {
    55     return [[[NSProcessInfo processInfo] processName] fileSystemRepresentation];
    56 }
    57 #else
    58 // -[NSProcessInfo processName] isn't thread-safe on Leopard and Snow Leopard so we have our own implementation.
    59 static const char* createProcessName()
    60 {
    61     uint32_t bufferSize = MAXPATHLEN;
    62     char executablePath[bufferSize];
    63    
    64     if (_NSGetExecutablePath(executablePath, &bufferSize))
    65         return "";
    66    
    67     const char *processName = strrchr(executablePath, '/') + 1;
    68     return strdup(processName);
    69 }
    70 
    71 static const char* processName()
    72 {
    73     static const char* processName = createProcessName();
    74     return processName;
    75 }
    76 #endif
    77 
    7852static void setUpTerminationNotificationHandler(pid_t pid)
    7953{
     
    227201
    228202    const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
    229     const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
     203    const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), 0 };
    230204
    231205    // Register ourselves.
  • trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm

    r71247 r76034  
    3636{
    3737#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
     38    parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
    3839    mach_port_t renderServerPort = WKInitializeRenderServer();
    3940    if (renderServerPort != MACH_PORT_NULL)
  • trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm

    r75822 r76034  
    7575
    7676    NSURLCache *urlCache = [NSURLCache sharedURLCache];
    77    
     77
     78    parameters.parentProcessName = [[NSProcessInfo processInfo] processName];   
    7879    parameters.nsURLCachePath = fileSystemRepresentation([(NSString *)cachePath.get() stringByStandardizingPath]);
    7980    parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm

    r75857 r76034  
    152152    initializeSandbox(parameters);
    153153
     154    if (!parameters.parentProcessName.isNull()) {
     155        // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
     156        NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parameters.parentProcessName];
     157        WKSetVisibleApplicationName((CFStringRef)applicationName);
     158    }
     159
    154160    if (!parameters.nsURLCachePath.isNull()) {
    155161        NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity;
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm

    r75814 r76034  
    8181    RunLoop::initializeMainRunLoop();
    8282
    83     // Set the visible application name.
    84     String parentProcessName = commandLine["parentprocessname"];
    85     if (!parentProcessName.isNull()) {
    86         // FIXME: Localization!
    87         NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName];
    88         WKSetVisibleApplicationName((CFStringRef)applicationName);
    89     }
    90 
    9183    // Create the connection.
    9284    WebProcess::shared().initialize(serverPort, RunLoop::main());
Note: See TracChangeset for help on using the changeset viewer.