summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-06 19:01:06 +0000
committernduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-06 19:01:06 +0000
commitf523b68eea59db2e5f9f9df34598d9203ff8786f (patch)
tree2ff403a602ee73672d32ca12626d950600848d9a
parenta5d0f5406e4b03cec41f6aea996c2840bfca9efb (diff)
downloadchromium_src-f523b68eea59db2e5f9f9df34598d9203ff8786f.zip
chromium_src-f523b68eea59db2e5f9f9df34598d9203ff8786f.tar.gz
chromium_src-f523b68eea59db2e5f9f9df34598d9203ff8786f.tar.bz2
If compositor window already exists, then simply return it rather than complaining. May affect how bug 65194 manifests.
BUG=65194 TEST=Verify against WebGL demos, poster circle content with tab opening and closing, as well as killing of GPU process. Review URL: http://codereview.chromium.org/5528007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68362 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu_process_host.cc16
-rw-r--r--chrome/browser/gpu_process_host.h2
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc7
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h2
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc2
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h2
-rw-r--r--chrome/common/gpu_messages_internal.h4
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc2
9 files changed, 22 insertions, 19 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index d4bb2db..abc8273 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -186,8 +186,8 @@ void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
OnAcceleratedSurfaceBuffersSwapped)
#elif defined(OS_WIN)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateCompositorHostWindow,
- OnCreateCompositorHostWindow)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetCompositorHostWindow,
+ OnGetCompositorHostWindow)
#endif
// If the IO thread does not handle the message then automatically route it
// to the UI thread. The UI thread will report an error if it does not
@@ -398,14 +398,14 @@ void SendDelayedReply(IPC::Message* reply_msg) {
GpuProcessHost::Get()->Send(reply_msg);
}
-void CreateCompositorHostWindowDispatcher(
+void GetCompositorHostWindowDispatcher(
int renderer_id,
int render_view_id,
IPC::Message* reply_msg) {
RenderViewHost* host = RenderViewHost::FromID(renderer_id,
render_view_id);
if (!host) {
- GpuHostMsg_CreateCompositorHostWindow::WriteReplyParams(reply_msg,
+ GpuHostMsg_GetCompositorHostWindow::WriteReplyParams(reply_msg,
gfx::kNullPluginWindow);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -414,10 +414,10 @@ void CreateCompositorHostWindowDispatcher(
}
RenderWidgetHostView* view = host->view();
- gfx::PluginWindowHandle id = view->CreateCompositorHostWindow();
+ gfx::PluginWindowHandle id = view->GetCompositorHostWindow();
- GpuHostMsg_CreateCompositorHostWindow::WriteReplyParams(reply_msg, id);
+ GpuHostMsg_GetCompositorHostWindow::WriteReplyParams(reply_msg, id);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableFunction(&SendDelayedReply, reply_msg));
@@ -425,13 +425,13 @@ void CreateCompositorHostWindowDispatcher(
} // namespace
-void GpuProcessHost::OnCreateCompositorHostWindow(
+void GpuProcessHost::OnGetCompositorHostWindow(
int renderer_id,
int render_view_id,
IPC::Message* reply_message) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(&CreateCompositorHostWindowDispatcher,
+ NewRunnableFunction(&GetCompositorHostWindowDispatcher,
renderer_id, render_view_id, reply_message));
}
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 05ae39e..6d8fc9d 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -95,7 +95,7 @@ class GpuProcessHost : public BrowserChildProcessHost, public NonThreadSafe {
void OnAcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
#elif defined(OS_WIN)
- void OnCreateCompositorHostWindow(int renderer_id,
+ void OnGetCompositorHostWindow(int renderer_id,
int render_view_id,
IPC::Message* reply_message);
#endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 8235ebf..81de506 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -247,7 +247,7 @@ class RenderWidgetHostView {
#endif
#if defined(OS_WIN)
- virtual gfx::PluginWindowHandle CreateCompositorHostWindow() = 0;
+ virtual gfx::PluginWindowHandle GetCompositorHostWindow() = 0;
virtual void WillWmDestroy() = 0;
virtual void ShowCompositorHostWindow(bool show) = 0;
#endif
@@ -261,7 +261,7 @@ class RenderWidgetHostView {
}
WebKit::WebPopupType popup_type() const { return popup_type_; }
- // Subclasses should override this method to do whatever is appropriate to set
+ // Subclasses should override this method to do is appropriate to set
// the custom background for their platform.
virtual void SetBackground(const SkBitmap& background) {
background_ = background;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 346045d..f41badf 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -1533,8 +1533,11 @@ static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message,
// Creates a HWND within the RenderWidgetHostView that will serve as a host
// for a HWND that the GPU process will create. The host window is used
// to Z-position the GPU's window relative to other plugin windows.
-gfx::PluginWindowHandle RenderWidgetHostViewWin::CreateCompositorHostWindow() {
- DCHECK(!compositor_host_window_);
+gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositorHostWindow() {
+ // If the window has been created, don't recreate it a second time
+ if (compositor_host_window_)
+ return compositor_host_window_;
+
static ATOM window_class = 0;
if (!window_class) {
WNDCLASSEX wcex;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index 1195a0c..b2b7546 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -158,7 +158,7 @@ class RenderWidgetHostViewWin
virtual bool ContainsNativeView(gfx::NativeView native_view) const;
virtual void SetVisuallyDeemphasized(bool deemphasized);
- virtual gfx::PluginWindowHandle CreateCompositorHostWindow();
+ virtual gfx::PluginWindowHandle GetCompositorHostWindow();
virtual void ShowCompositorHostWindow(bool show);
virtual void OnAccessibilityNotifications(
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc
index c12b942..72674497 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.cc
+++ b/chrome/browser/renderer_host/test/test_render_view_host.cc
@@ -188,7 +188,7 @@ void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped(
void TestRenderWidgetHostView::GpuRenderingStateDidChange() {
}
#elif defined(OS_WIN)
-gfx::PluginWindowHandle TestRenderWidgetHostView::CreateCompositorHostWindow() {
+gfx::PluginWindowHandle TestRenderWidgetHostView::GetCompositorHostWindow() {
return gfx::kNullPluginWindow;
}
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 b8020c7..01ed8e4 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test/test_render_view_host.h
@@ -126,7 +126,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
uint64 swap_buffers_count);
virtual void GpuRenderingStateDidChange();
#elif defined(OS_WIN)
- virtual gfx::PluginWindowHandle CreateCompositorHostWindow();
+ virtual gfx::PluginWindowHandle GetCompositorHostWindow();
virtual void WillWmDestroy();
virtual void ShowCompositorHostWindow(bool show);
#endif
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 6ad6449..e4badaa 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -119,8 +119,8 @@ IPC_BEGIN_MESSAGES(GpuHost)
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
#elif defined(OS_WIN)
- // Create and get the HWND for the compositor window
- IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateCompositorHostWindow,
+ // Get the HWND for the compositor window and if necessary, create it
+ IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_GetCompositorHostWindow,
int32, /* renderer_id */
int32, /* render_view_id */
gfx::PluginWindowHandle /* compositor_host_id */)
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index f11308d..6ad18bc 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -83,7 +83,7 @@ bool GpuCommandBufferStub::CreateCompositorWindow() {
// Ask the browser to create the the host window.
ChildThread* gpu_thread = ChildThread::current();
gfx::PluginWindowHandle host_window_id = gfx::kNullPluginWindow;
- gpu_thread->Send(new GpuHostMsg_CreateCompositorHostWindow(
+ gpu_thread->Send(new GpuHostMsg_GetCompositorHostWindow(
renderer_id_,
render_view_id_,
&host_window_id));