summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gpu_process_host.cc17
-rw-r--r--chrome/browser/gpu_process_host.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc7
-rw-r--r--chrome/common/gpu_messages_internal.h12
-rw-r--r--chrome/gpu/gpu_channel.cc13
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc9
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.h4
7 files changed, 51 insertions, 15 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index f01b7d3..e18326b 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -14,6 +14,10 @@
#include "chrome/common/render_messages.h"
#include "ipc/ipc_switches.h"
+#if defined(OS_LINUX)
+#include "gfx/gtk_native_view_id_manager.h"
+#endif
+
namespace {
// Tasks used by this file
@@ -147,6 +151,9 @@ void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
+#if defined(OS_LINUX)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_GetViewXID, OnGetViewXID)
+#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
@@ -165,6 +172,16 @@ void GpuProcessHost::OnSynchronizeReply() {
queued_synchronization_replies_.pop();
}
+#if defined(OS_LINUX)
+void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id, unsigned long* xid) {
+ GtkNativeViewManager* manager = Singleton<GtkNativeViewManager>::get();
+ if (!manager->GetXIDForId(xid, id)) {
+ DLOG(ERROR) << "Can't find XID for view id " << id;
+ *xid = 0;
+ }
+}
+#endif
+
void GpuProcessHost::ReplyToRenderer(
const IPC::ChannelHandle& channel,
ResourceMessageFilter* filter) {
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 2f2d5b6..9638f11 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -11,6 +11,7 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/child_process_host.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
+#include "gfx/native_widget_types.h"
class ChildProcessLauncher;
class CommandBufferProxy;
@@ -79,6 +80,9 @@ class GpuProcessHost : public ChildProcessHost {
// Message handlers.
void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
void OnSynchronizeReply();
+#if defined(OS_LINUX)
+ void OnGetViewXID(gfx::NativeViewId id, unsigned long* xid);
+#endif
void ReplyToRenderer(const IPC::ChannelHandle& channel,
ResourceMessageFilter* filter);
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 542dcf6..197491e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -815,6 +815,13 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
return;
}
+ // Don't do any painting if the GPU process is rendering directly
+ // into the View.
+ RenderWidgetHost* render_widget_host = GetRenderWidgetHost();
+ if (render_widget_host->is_gpu_rendering_active()) {
+ return;
+ }
+
GdkWindow* window = view_.get()->window;
DCHECK(!about_to_validate_and_paint_);
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index c2a2232..4c1a1ba 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -83,11 +83,6 @@ IPC_END_MESSAGES(Gpu)
// These are messages from the GPU process to the browser.
IPC_BEGIN_MESSAGES(GpuHost)
- // This message is sent in response to BackingStoreMsg_New to tell the host
- // about the child window that was just created.
- IPC_MESSAGE_ROUTED1(GpuHostMsg_CreatedRenderWidgetHostView,
- gfx::NativeViewId)
-
// Sent in response to GpuMsg_PaintToBackingStore, see that for more.
IPC_MESSAGE_ROUTED0(GpuHostMsg_PaintToBackingStore_ACK)
@@ -101,6 +96,13 @@ IPC_BEGIN_MESSAGES(GpuHost)
// Response to a GpuMsg_Synchronize message.
IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
+#if defined(OS_LINUX)
+ // Get the XID for a view ID.
+ IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID,
+ gfx::NativeViewId, /* view */
+ unsigned long /* xid */)
+#endif
+
IPC_END_MESSAGES(GpuHost)
//------------------------------------------------------------------------------
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index b775acf..c0470f7 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -137,6 +137,7 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id,
#if defined(ENABLE_GPU)
+ gfx::PluginWindowHandle handle = NULL;
#if defined(OS_WIN)
gfx::NativeView view = gfx::NativeViewFromId(view_id);
@@ -146,17 +147,25 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id,
GetProp(view, chrome::kChromiumRendererIdProperty));
if (view_renderer_id != renderer_id_)
return;
+ handle = view;
+#elif defined(OS_LINUX)
+ ChildThread* gpu_thread = ChildThread::current();
+ // Ask the browser for the view's XID.
+ // TODO(piman): This assumes that it doesn't change. It can change however
+ // when tearing off tabs. This needs a fix in the browser UI code. A possible
+ // alternative would be to add a socket/plug pair like with plugins but that
+ // has issues with events and focus.
+ gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle));
#else
// TODO(apatrick): This needs to be something valid for mac and linux.
// Offscreen rendering will work on these platforms but not rendering to the
// window.
DCHECK_EQ(view_id, 0);
- gfx::NativeView view = 0;
#endif
*route_id = GenerateRouteID();
scoped_refptr<GpuCommandBufferStub> stub = new GpuCommandBufferStub(
- this, view, NULL, gfx::Size(), 0, *route_id);
+ this, handle, NULL, gfx::Size(), 0, *route_id);
router_.AddRoute(*route_id, stub);
stubs_[*route_id] = stub;
#endif // ENABLE_GPU
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index a95b4c1..ee9d937 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -14,13 +14,13 @@
using gpu::Buffer;
GpuCommandBufferStub::GpuCommandBufferStub(GpuChannel* channel,
- gfx::NativeView view,
+ gfx::PluginWindowHandle handle,
GpuCommandBufferStub* parent,
const gfx::Size& size,
uint32 parent_texture_id,
int32 route_id)
: channel_(channel),
- view_(view),
+ handle_(handle),
parent_(parent),
initial_size_(size),
parent_texture_id_(parent_texture_id),
@@ -73,11 +73,8 @@ void GpuCommandBufferStub::OnInitialize(
parent_ ? parent_->processor_.get() : NULL;
processor_.reset(new gpu::GPUProcessor(command_buffer_.get()));
// TODO(apatrick): The reinterpret_cast below is only valid on windows.
-#if !defined(OS_WIN)
- DCHECK_EQ(view_, static_cast<gfx::NativeView>(0));
-#endif
if (processor_->Initialize(
- reinterpret_cast<gfx::PluginWindowHandle>(view_),
+ handle_,
initial_size_,
parent_processor,
parent_texture_id_)) {
diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h
index 7aaf68a..91d7029 100644
--- a/chrome/gpu/gpu_command_buffer_stub.h
+++ b/chrome/gpu/gpu_command_buffer_stub.h
@@ -24,7 +24,7 @@ class GpuCommandBufferStub
public base::RefCountedThreadSafe<GpuCommandBufferStub> {
public:
GpuCommandBufferStub(GpuChannel* channel,
- gfx::NativeView view,
+ gfx::PluginWindowHandle handle,
GpuCommandBufferStub* parent,
const gfx::Size& size,
uint32 parent_texture_id,
@@ -55,7 +55,7 @@ class GpuCommandBufferStub
void OnResizeOffscreenFrameBuffer(const gfx::Size& size);
scoped_refptr<GpuChannel> channel_;
- gfx::NativeView view_;
+ gfx::PluginWindowHandle handle_;
scoped_refptr<GpuCommandBufferStub> parent_;
gfx::Size initial_size_;
uint32 parent_texture_id_;