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

Unified Diff: chrome/ppapi_plugin/plugin_process_dispatcher.cc

Issue 6493004: Implement basic crash detection and shutdown handling for out of process PPAP... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/ppapi_plugin/plugin_process_dispatcher.h ('k') | chrome/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ppapi_plugin/plugin_process_dispatcher.cc
===================================================================
--- chrome/ppapi_plugin/plugin_process_dispatcher.cc (revision 0)
+++ chrome/ppapi_plugin/plugin_process_dispatcher.cc (revision 0)
@@ -0,0 +1,38 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/ppapi_plugin/plugin_process_dispatcher.h"
+
+#include "chrome/common/child_process.h"
+
+namespace {
+
+class PluginReleaseTask : public Task {
+ public:
+ void Run() {
+ ChildProcess::current()->ReleaseProcess();
+ }
+};
+
+// How long we wait before releasing the plugin process.
+const int kPluginReleaseTimeMs = 30 * 1000; // 30 seconds.
+
+} // namespace
+
+PluginProcessDispatcher::PluginProcessDispatcher(
+ base::ProcessHandle remote_process_handle,
+ GetInterfaceFunc get_interface)
+ : pp::proxy::PluginDispatcher(remote_process_handle, get_interface) {
+ ChildProcess::current()->AddRefProcess();
+}
+
+PluginProcessDispatcher::~PluginProcessDispatcher() {
+ // Don't free the process right away. This timer allows the child process
+ // to be re-used if the user rapidly goes to a new page that requires this
+ // plugin. This is the case for common plugins where they may be used on a
+ // source and destination page of a navigation. We don't want to tear down
+ // and re-start processes each time in these cases.
+ MessageLoop::current()->PostDelayedTask(FROM_HERE, new PluginReleaseTask(),
+ kPluginReleaseTimeMs);
+}
Property changes on: chrome/ppapi_plugin/plugin_process_dispatcher.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/ppapi_plugin/plugin_process_dispatcher.h ('k') | chrome/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698