Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320)
[chromium-blink-merge.git] / content / ppapi_plugin / plugin_process_dispatcher.cc
blob3bfc46a3b8ba65cda146e594475a6b945821c3c8
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/ppapi_plugin/plugin_process_dispatcher.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "content/child/child_process.h"
11 namespace content {
12 namespace {
14 // How long we wait before releasing the plugin process.
15 const int kPluginReleaseTimeSeconds = 30;
17 } // namespace
19 PluginProcessDispatcher::PluginProcessDispatcher(
20 PP_GetInterface_Func get_interface,
21 const ppapi::PpapiPermissions& permissions,
22 bool incognito)
23 : ppapi::proxy::PluginDispatcher(get_interface,
24 permissions,
25 incognito) {
28 PluginProcessDispatcher::~PluginProcessDispatcher() {
29 // Don't free the process right away. This timer allows the child process
30 // to be re-used if the user rapidly goes to a new page that requires this
31 // plugin. This is the case for common plugins where they may be used on a
32 // source and destination page of a navigation. We don't want to tear down
33 // and re-start processes each time in these cases.
34 process_ref_.ReleaseWithDelay(
35 base::TimeDelta::FromSeconds(kPluginReleaseTimeSeconds));
38 } // namespace content