summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/plugin_thread.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:45:59 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:45:59 +0000
commit51d70e07bd5d991420bc0f14ff05f1a9b72d02db (patch)
tree718c0b24680c1b14eb4570403cc15b8d09b4002d /chrome/plugin/plugin_thread.cc
parent70ac249f04337f0040ad63a72ced111d87fdc73a (diff)
downloadchromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.zip
chromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.tar.gz
chromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.tar.bz2
Refactor plugin process code which checks with the browser process before shutdown, to avoid races in which the browser process thinks the process is fine to use while it's shutting down. I also removed PluginProcess/WorkerProcess since they didn't have any code in them now.
I removed the plugin process code which waits 10 seconds before shutting itself down. That was a premature optimization, since testing with/without this didn't show any difference (see http://www/~jabdelmalek/chrome/test/plugins/processes.html). In both cases, the plugin on a page would get recreated in less than 100ms, even with reusing or starting a plugin process from scratch. We already spawn new renderer processes on back and forth if it's a different origin, and the plugin will be in the cache anyways. Review URL: http://codereview.chromium.org/53091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_thread.cc')
-rw-r--r--chrome/plugin/plugin_thread.cc17
1 files changed, 3 insertions, 14 deletions
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 10172e7..9993c37 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -8,6 +8,7 @@
#include "chrome/plugin/plugin_thread.h"
#include "base/command_line.h"
+#include "chrome/common/child_process.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
@@ -15,7 +16,6 @@
#include "chrome/common/render_messages.h"
#include "chrome/plugin/chrome_plugin_host.h"
#include "chrome/plugin/npobject_util.h"
-#include "chrome/plugin/plugin_process.h"
#include "chrome/renderer/render_thread.h"
#include "net/base/net_errors.h"
#include "webkit/glue/plugins/plugin_lib.h"
@@ -40,9 +40,7 @@ PluginThread* PluginThread::current() {
void PluginThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PluginThread, msg)
IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel)
- IPC_MESSAGE_HANDLER(PluginProcessMsg_ShutdownResponse, OnShutdownResponse)
IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage)
- IPC_MESSAGE_HANDLER(PluginProcessMsg_BrowserShutdown, OnBrowserShutdown)
IPC_END_MESSAGE_MAP()
}
@@ -100,27 +98,18 @@ void PluginThread::OnCreateChannel(bool off_the_record) {
Send(new PluginProcessHostMsg_ChannelCreated(channel_name));
}
-void PluginThread::OnShutdownResponse(bool ok_to_shutdown) {
- if (ok_to_shutdown)
- PluginProcess::current()->Shutdown();
-}
-
-void PluginThread::OnBrowserShutdown() {
- PluginProcess::current()->Shutdown();
-}
-
void PluginThread::OnPluginMessage(const std::vector<unsigned char> &data) {
// We Add/Release ref here to ensure that something will trigger the
// shutdown mechanism for processes started in the absence of renderer's
// opening a plugin channel.
- PluginProcess::current()->AddRefProcess();
+ ChildProcess::current()->AddRefProcess();
ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path_);
if (chrome_plugin) {
void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
uint32 data_len = static_cast<uint32>(data.size());
chrome_plugin->functions().on_message(data_ptr, data_len);
}
- PluginProcess::current()->ReleaseProcess();
+ ChildProcess::current()->ReleaseProcess();
}
namespace webkit_glue {