Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: content/ppapi_plugin/plugin_process_dispatcher.cc

Issue 9185026: Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove static class initializations. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/ppapi_plugin/plugin_process_dispatcher.h" 5 #include "content/ppapi_plugin/plugin_process_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "content/common/child_process.h" 9 #include "content/common/child_process.h"
10 10
11 namespace { 11 namespace {
12 12
13 // How long we wait before releasing the plugin process. 13 // How long we wait before releasing the plugin process.
14 const int kPluginReleaseTimeMs = 30 * 1000; // 30 seconds. 14 const base::TimeDelta kPluginReleaseTime =
brettw 2012/01/15 17:28:15 I don't think we want this static class, right? I'
15 base::TimeDelta::FromSeconds(30);
15 16
16 } // namespace 17 } // namespace
17 18
18 PluginProcessDispatcher::PluginProcessDispatcher( 19 PluginProcessDispatcher::PluginProcessDispatcher(
19 base::ProcessHandle remote_process_handle, 20 base::ProcessHandle remote_process_handle,
20 GetInterfaceFunc get_interface) 21 GetInterfaceFunc get_interface)
21 : ppapi::proxy::PluginDispatcher(remote_process_handle, get_interface) { 22 : ppapi::proxy::PluginDispatcher(remote_process_handle, get_interface) {
22 ChildProcess::current()->AddRefProcess(); 23 ChildProcess::current()->AddRefProcess();
23 } 24 }
24 25
25 PluginProcessDispatcher::~PluginProcessDispatcher() { 26 PluginProcessDispatcher::~PluginProcessDispatcher() {
26 // Don't free the process right away. This timer allows the child process 27 // Don't free the process right away. This timer allows the child process
27 // to be re-used if the user rapidly goes to a new page that requires this 28 // to be re-used if the user rapidly goes to a new page that requires this
28 // plugin. This is the case for common plugins where they may be used on a 29 // plugin. This is the case for common plugins where they may be used on a
29 // source and destination page of a navigation. We don't want to tear down 30 // source and destination page of a navigation. We don't want to tear down
30 // and re-start processes each time in these cases. 31 // and re-start processes each time in these cases.
31 MessageLoop::current()->PostDelayedTask( 32 MessageLoop::current()->PostDelayedTask(
32 FROM_HERE, 33 FROM_HERE,
33 base::Bind(&ChildProcess::ReleaseProcess, 34 base::Bind(&ChildProcess::ReleaseProcess,
34 base::Unretained(ChildProcess::current())), 35 base::Unretained(ChildProcess::current())),
35 kPluginReleaseTimeMs); 36 kPluginReleaseTime);
36 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698