diff options
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r-- | chrome/renderer/render_widget.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 343db541..7d59256 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -147,6 +147,7 @@ IPC_DEFINE_MESSAGE_MAP(RenderWidget) IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) + IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() @@ -725,6 +726,17 @@ void RenderWidget::OnSetTextDirection(WebTextDirection direction) { webwidget_->setTextDirection(direction); } +void RenderWidget::OnGpuChannelEstablished( + const IPC::ChannelHandle& channel_handle) { + if (channel_handle.name.size() != 0) { + // Connect to the GPU process if a channel name was received. + gpu_channel_->Connect(channel_handle.name); + } else { + // Otherwise cancel the connection. + gpu_channel_ = NULL; + } +} + void RenderWidget::SetHidden(bool hidden) { if (is_hidden_ == hidden) return; @@ -867,3 +879,32 @@ void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { } } } + +void RenderWidget::EstablishGpuChannel() { + if (gpu_channel_.get()) { + // Do nothing if we are already establishing GPU channel. + if (gpu_channel_->state() == GpuChannelHost::UNCONNECTED) + return; + + // Recreate the channel if it has been lost. + if (gpu_channel_->state() == GpuChannelHost::LOST) + gpu_channel_ = NULL; + } + + if (!gpu_channel_.get()) + gpu_channel_ = new GpuChannelHost; + + // Ask the browser for the channel name. + CHECK(Send(new ViewHostMsg_EstablishGpuChannel(routing_id_))); +} + +GpuChannelHost* RenderWidget::GetGpuChannel() { + if (!gpu_channel_.get()) + return NULL; + + if (gpu_channel_->state() != GpuChannelHost::CONNECTED) + return NULL; + + return gpu_channel_.get(); +} + |