Changeset 148038 in webkit


Ignore:
Timestamp:
Apr 9, 2013 12:48:01 PM (11 years ago)
Author:
dino@apple.com
Message:

Don't create another plugin process for restarted plugins
https://bugs.webkit.org/show_bug.cgi?id=114233

Reviewed by Geoff Garen.

A snapshotting plugin starts in a separate process from
regular plugins. This can be a little confusing to users
because they might see two plugin processes. We can set
the minimum life and timeout on the snapshotting process
to much smaller values, since the process doesn't need
to live that long. This will reduce some potential
confusion. Also, since there is another plugin process
running real plugins, it should be paged in if it needs
to restart.

There was, however, a bug in the process management. A
restarted plugin received a special PluginProcess::Type,
so that it could cross fade into the page nicely. This
caused it to start a *third* plugin process. Instead
mark a restarted flag directly on the PluginProxy and
revert back to two process types.

  • PluginProcess/PluginProcess.h: Remove TypeRestartedProcess.
  • UIProcess/Plugins/PluginProcessProxy.cpp: Add two new

timeout values for snapshotting processes.

(WebKit::PluginProcessProxy::didFinishLaunching): Chose which

of the timeout pairs to use.

  • WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:

(WebKit::PluginProxy::pluginLayer): Don't look at the process type, instead

look at the process flag to see if we are restarted.

  • WebProcess/Plugins/PluginProxy.cpp:

(WebKit::PluginProxy::create): Copy the new flag into constructor.
(WebKit::PluginProxy::PluginProxy): Remember the flag.

  • WebProcess/Plugins/PluginProxy.h: Add a new m_restartedProcess flag.
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::createPlugin): When we are creating the proxy, separate

the concept of snapshotting and restarting.

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r148034 r148038  
     12013-04-08  Dean Jackson  <dino@apple.com>
     2
     3        Don't create another plugin process for restarted plugins
     4        https://bugs.webkit.org/show_bug.cgi?id=114233
     5
     6        Reviewed by Geoff Garen.
     7
     8        A snapshotting plugin starts in a separate process from
     9        regular plugins. This can be a little confusing to users
     10        because they might see two plugin processes. We can set
     11        the minimum life and timeout on the snapshotting process
     12        to much smaller values, since the process doesn't need
     13        to live that long. This will reduce some potential
     14        confusion. Also, since there is another plugin process
     15        running real plugins, it should be paged in if it needs
     16        to restart.
     17
     18        There was, however, a bug in the process management. A
     19        restarted plugin received a special PluginProcess::Type,
     20        so that it could cross fade into the page nicely. This
     21        caused it to start a *third* plugin process. Instead
     22        mark a restarted flag directly on the PluginProxy and
     23        revert back to two process types.
     24
     25        * PluginProcess/PluginProcess.h: Remove TypeRestartedProcess.
     26
     27        * UIProcess/Plugins/PluginProcessProxy.cpp: Add two new
     28            timeout values for snapshotting processes.
     29        (WebKit::PluginProcessProxy::didFinishLaunching): Chose which
     30            of the timeout pairs to use.
     31
     32        * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
     33        (WebKit::PluginProxy::pluginLayer): Don't look at the process type, instead
     34            look at the process flag to see if we are restarted.
     35        * WebProcess/Plugins/PluginProxy.cpp:
     36        (WebKit::PluginProxy::create): Copy the new flag into constructor.
     37        (WebKit::PluginProxy::PluginProxy): Remember the flag.
     38        * WebProcess/Plugins/PluginProxy.h: Add a new m_restartedProcess flag.
     39
     40        * WebProcess/WebPage/WebPage.cpp:
     41        (WebKit::WebPage::createPlugin): When we are creating the proxy, separate
     42            the concept of snapshotting and restarting.
     43
    1442013-04-09  Tim Horton  <timothy_horton@apple.com>
    245
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.h

    r147579 r148038  
    4545        // Start with value one since default HashTraits<> disallows zero as key.
    4646        TypeRegularProcess = 1,
    47         TypeSnapshotProcess,
    48         TypeRestartedProcess
     47        TypeSnapshotProcess
    4948    };
    5049
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp

    r147138 r148038  
    4949
    5050static const double minimumLifetime = 2 * 60;
     51static const double snapshottingMinimumLifetime = 30;
     52
    5153static const double shutdownTimeout = 1 * 60;
     54static const double snapshottingShutdownTimeout = 15;
    5255
    5356PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType)
     
    201204    PluginProcessCreationParameters parameters;
    202205    parameters.processType = m_processType;
    203     parameters.minimumLifetime = minimumLifetime;
    204     parameters.terminationTimeout = shutdownTimeout;
     206    if (m_processType == PluginProcess::TypeSnapshotProcess) {
     207        parameters.minimumLifetime = snapshottingMinimumLifetime;
     208        parameters.terminationTimeout = snapshottingShutdownTimeout;
     209    } else {
     210        parameters.minimumLifetime = minimumLifetime;
     211        parameters.terminationTimeout = shutdownTimeout;
     212    }
    205213    platformInitializePluginProcess(parameters);
    206214
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm

    r147579 r148038  
    5555        [m_pluginLayer.get() setGeometryFlipped:YES];
    5656
    57         if (m_processType == PluginProcess::TypeRestartedProcess) {
     57        if (m_isRestartedProcess) {
    5858            CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
    5959            fadeInAnimation.fromValue = [NSNumber numberWithFloat:0];
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r147253 r148038  
    5757}
    5858
    59 PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath, PluginProcess::Type processType)
    60 {
    61     return adoptRef(new PluginProxy(pluginPath, processType));
    62 }
    63 
    64 PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processType)
     59PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath, PluginProcess::Type processType, bool isRestartedProcess)
     60{
     61    return adoptRef(new PluginProxy(pluginPath, processType, isRestartedProcess));
     62}
     63
     64PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processType, bool isRestartedProcess)
    6565    : m_pluginPath(pluginPath)
    6666    , m_pluginInstanceID(generatePluginInstanceID())
     
    7272    , m_waitingOnAsynchronousInitialization(false)
    7373    , m_processType(processType)
     74    , m_isRestartedProcess(isRestartedProcess)
    7475{
    7576}
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h

    r145477 r148038  
    5757class PluginProxy : public Plugin {
    5858public:
    59     static PassRefPtr<PluginProxy> create(const String& pluginPath, PluginProcess::Type);
     59    static PassRefPtr<PluginProxy> create(const String& pluginPath, PluginProcess::Type, bool isRestartedProcess);
    6060    ~PluginProxy();
    6161
     
    6969
    7070private:
    71     explicit PluginProxy(const String& pluginPath, PluginProcess::Type);
     71    explicit PluginProxy(const String& pluginPath, PluginProcess::Type, bool isRestartedProcess);
    7272
    7373    // Plugin
     
    219219
    220220    PluginProcess::Type m_processType;
     221    bool m_isRestartedProcess;
    221222};
    222223
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r148000 r148038  
    560560#if ENABLE(PLUGIN_PROCESS)
    561561
    562     PluginProcess::Type processType = PluginProcess::TypeRegularProcess;
    563     if (pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot)
    564         processType = PluginProcess::TypeSnapshotProcess;
    565     else if (pluginElement->displayState() == HTMLPlugInElement::Restarting || pluginElement->displayState() == HTMLPlugInElement::RestartingWithPendingMouseClick)
    566         processType = PluginProcess::TypeRestartedProcess;
    567     return PluginProxy::create(pluginPath, processType);
     562    PluginProcess::Type processType = (pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcess::TypeSnapshotProcess : PluginProcess::TypeRegularProcess);
     563    bool isRestartedProcess = (pluginElement->displayState() == HTMLPlugInElement::Restarting || pluginElement->displayState() == HTMLPlugInElement::RestartingWithPendingMouseClick);
     564    return PluginProxy::create(pluginPath, processType, isRestartedProcess);
    568565#else
    569566    NetscapePlugin::setSetExceptionFunction(NPRuntimeObjectMap::setGlobalException);
Note: See TracChangeset for help on using the changeset viewer.