summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_view_host.h2
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc25
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h9
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h4
-rw-r--r--chrome/common/ipc_message_utils.h6
-rw-r--r--chrome/common/render_messages_internal.h12
-rw-r--r--chrome/renderer/render_view.cc5
-rw-r--r--chrome/renderer/render_view.h4
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc4
13 files changed, 70 insertions, 20 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index b41c04c..ff6b8e3 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1361,7 +1361,10 @@ void RenderViewHost::OnMissingPluginStatus(int status) {
integration_delegate->OnMissingPluginStatus(status);
}
-void RenderViewHost::OnCrashedPlugin(const FilePath& plugin_path) {
+void RenderViewHost::OnCrashedPlugin(base::ProcessId pid,
+ const FilePath& plugin_path) {
+ view()->PluginProcessCrashed(pid);
+
RenderViewHostDelegate::BrowserIntegration* integration_delegate =
delegate_->GetBrowserIntegrationDelegate();
if (integration_delegate)
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index a43c5a2..90a4d53 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -525,7 +525,7 @@ class RenderViewHost : public RenderWidgetHost,
void OnUserMetricsRecordAction(const std::wstring& action);
void OnMissingPluginStatus(int status);
- void OnCrashedPlugin(const FilePath& plugin_path);
+ void OnCrashedPlugin(base::ProcessId pid, const FilePath& plugin_path);
void OnMessageReceived(IPC::Message* msg) { }
void OnReceivedSavableResourceLinksForCurrentPage(
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index cdadd9e..b6369d8 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -754,8 +754,9 @@ void RenderWidgetHost::OnMsgImeUpdateStatus(int control,
#if defined(OS_LINUX)
void RenderWidgetHost::OnMsgCreatePluginContainer(
- gfx::PluginWindowHandle *container) {
- *container = view_->CreatePluginContainer();
+ base::ProcessId pid,
+ gfx::PluginWindowHandle* container) {
+ *container = view_->CreatePluginContainer(pid);
}
void RenderWidgetHost::OnMsgDestroyPluginContainer(
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index e133670..88bcf18 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -8,6 +8,7 @@
#include <queue>
#include <vector>
+#include "base/process.h"
#include "base/gfx/native_widget_types.h"
#include "base/gfx/size.h"
#include "base/scoped_ptr.h"
@@ -394,7 +395,8 @@ class RenderWidgetHost : public IPC::Channel::Listener {
// having to bring in render_messages.h in a header file.
void OnMsgImeUpdateStatus(int control, const gfx::Rect& caret_rect);
#if defined(OS_LINUX)
- void OnMsgCreatePluginContainer(gfx::PluginWindowHandle *container);
+ void OnMsgCreatePluginContainer(base::ProcessId pid,
+ gfx::PluginWindowHandle* container);
void OnMsgDestroyPluginContainer(gfx::PluginWindowHandle container);
#elif defined(OS_MACOSX)
void OnMsgShowPopup(const ViewHostMsg_ShowPopup_Params& params);
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 0837bc7..b5609e2 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -159,10 +159,13 @@ class RenderWidgetHostView {
#endif
#if defined(OS_LINUX)
- virtual gfx::PluginWindowHandle CreatePluginContainer() = 0;
+ virtual gfx::PluginWindowHandle CreatePluginContainer(
+ base::ProcessId plugin_process_id) = 0;
virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) = 0;
#endif
+ virtual void PluginProcessCrashed(base::ProcessId pid) { }
+
void set_activatable(bool activatable) {
activatable_ = activatable;
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 2693be6..3bb7425 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -16,6 +16,7 @@
#include "base/string_util.h"
#include "base/task.h"
#include "base/time.h"
+#include "chrome/browser/plugin_process_host.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/x11_util.h"
@@ -725,11 +726,31 @@ void RenderWidgetHostViewGtk::ReceivedSelectionText(GtkClipboard* clipboard,
UTF8ToUTF16(text)));
}
-gfx::PluginWindowHandle RenderWidgetHostViewGtk::CreatePluginContainer() {
- return plugin_container_manager_.CreatePluginContainer();
+gfx::PluginWindowHandle RenderWidgetHostViewGtk::CreatePluginContainer(
+ base::ProcessId plugin_process_id) {
+ gfx::PluginWindowHandle handle =
+ plugin_container_manager_.CreatePluginContainer();
+ plugin_pid_map_.insert(std::make_pair(plugin_process_id, handle));
+ return handle;
}
void RenderWidgetHostViewGtk::DestroyPluginContainer(
gfx::PluginWindowHandle container) {
plugin_container_manager_.DestroyPluginContainer(container);
+
+ for (PluginPidMap::iterator i = plugin_pid_map_.begin();
+ i != plugin_pid_map_.end(); ++i) {
+ if (i->second == container) {
+ plugin_pid_map_.erase(i);
+ break;
+ }
+ }
+}
+
+void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) {
+ for (PluginPidMap::iterator i = plugin_pid_map_.find(pid);
+ i != plugin_pid_map_.end() && i->first == pid; ++i) {
+ plugin_container_manager_.DestroyPluginContainer(i->second);
+ }
+ plugin_pid_map_.erase(pid);
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 1caa1ac..d4a40ef 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -60,8 +60,10 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
virtual void PasteFromSelectionClipboard();
virtual void ShowingContextMenu(bool showing);
virtual BackingStore* AllocBackingStore(const gfx::Size& size);
- virtual gfx::PluginWindowHandle CreatePluginContainer();
+ virtual gfx::PluginWindowHandle CreatePluginContainer(
+ base::ProcessId plugin_process_id);
virtual void DestroyPluginContainer(gfx::PluginWindowHandle container);
+ virtual void PluginProcessCrashed(base::ProcessId pid);
gfx::NativeView native_view() const { return view_.get(); }
@@ -143,6 +145,11 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
// Helper class that lets us allocate plugin containers and move them.
GtkPluginContainerManager plugin_container_manager_;
+
+ // A map of plugin process id -> windows related to that process.
+ // Lets us clean up immediately when a plugin process crashes.
+ typedef std::multimap<base::ProcessId, gfx::PluginWindowHandle> PluginPidMap;
+ PluginPidMap plugin_pid_map_;
};
#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h
index dcc3e1a..aa24b0c 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test/test_render_view_host.h
@@ -82,7 +82,9 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
#endif
#if defined(OS_LINUX)
- virtual gfx::PluginWindowHandle CreatePluginContainer() { return 0; }
+ virtual gfx::PluginWindowHandle CreatePluginContainer(base::ProcessId) {
+ return 0;
+ }
virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) { }
#endif
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index ee199e2..8661507 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -179,8 +179,10 @@ struct ParamTraits<long> {
}
};
-#if defined(OS_LINUX)
-// unsigned long is used for serializing X window ids.
+#if defined(OS_LINUX) || defined(OS_WIN)
+// On Linux, unsigned long is used for serializing X window ids.
+// On Windows, it's used for serializing process ids.
+// On Mac, it conflicts with some other definition.
template <>
struct ParamTraits<unsigned long> {
typedef unsigned long param_type;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index d3046d0..5410091 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -945,8 +945,15 @@ IPC_BEGIN_MESSAGES(ViewHost)
FilePath /* plugin_path */)
#if defined(OS_LINUX)
- IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_CreatePluginContainer,
+ // A renderer sends this when it needs a browser-side widget for
+ // hosting a windowed plugin. The PID is the PID of the *plugin*
+ // process, which is used to associate the browser-side container with
+ // the lifetime of the plugin process.
+ IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_CreatePluginContainer,
+ base::ProcessId /* pid */,
gfx::PluginWindowHandle /* container */)
+
+ // Destroy a plugin container previously created using CreatePluginContainer.
IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_DestroyPluginContainer,
gfx::PluginWindowHandle /* container */)
#endif
@@ -1152,7 +1159,8 @@ IPC_BEGIN_MESSAGES(ViewHost)
// Sent by the renderer process to indicate that a plugin instance has
// crashed.
- IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin,
+ IPC_MESSAGE_ROUTED2(ViewHostMsg_CrashedPlugin,
+ base::ProcessId /* plugin process id */,
FilePath /* plugin_path */)
// Displays a JavaScript out-of-memory message in the infobar.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 436de6e..15d7771 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -255,8 +255,9 @@ void RenderView::PluginDestroyed(WebPluginDelegateProxy* proxy) {
first_default_plugin_ = NULL;
}
-void RenderView::PluginCrashed(const FilePath& plugin_path) {
- Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path));
+void RenderView::PluginCrashed(base::ProcessId pid,
+ const FilePath& plugin_path) {
+ Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path));
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index ba6374d..0b1a38a 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -325,8 +325,8 @@ class RenderView : public RenderWidget,
// Called when a plugin is destroyed.
void PluginDestroyed(WebPluginDelegateProxy* proxy);
- // Called when a plugin is crashed.
- void PluginCrashed(const FilePath& plugin_path);
+ // Called when a plugin has crashed.
+ void PluginCrashed(base::ProcessId pid, const FilePath& plugin_path);
// Called from JavaScript window.external.AddSearchProvider() to add a
// keyword for a provider described in the given OpenSearch document.
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index c723097..a5423ac 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -386,7 +386,7 @@ void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
void WebPluginDelegateProxy::OnChannelError() {
if (plugin_)
plugin_->Invalidate();
- render_view_->PluginCrashed(plugin_path_);
+ render_view_->PluginCrashed(GetProcessId(), plugin_path_);
}
void WebPluginDelegateProxy::UpdateGeometry(
@@ -709,7 +709,7 @@ void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) {
void WebPluginDelegateProxy::OnCreatePluginContainer(
gfx::PluginWindowHandle* container) {
RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer(
- render_view_->routing_id(), container));
+ render_view_->routing_id(), GetProcessId(), container));
}
void WebPluginDelegateProxy::OnDestroyPluginContainer(