Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/gpu_channel_host.h" | 5 #include "chrome/renderer/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include "chrome/common/child_process.h" | 7 #include "chrome/common/child_process.h" |
| 8 #include "chrome/common/gpu_create_command_buffer_config.h" | 8 #include "chrome/common/gpu_create_command_buffer_config.h" |
| 9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
| 10 #include "chrome/renderer/command_buffer_proxy.h" | 10 #include "chrome/renderer/command_buffer_proxy.h" |
| 11 #include "chrome/renderer/gpu_video_service_host.h" | 11 #include "chrome/renderer/gpu_video_service_host.h" |
| 12 #include "chrome/renderer/render_thread.h" | 12 #include "chrome/renderer/render_thread.h" |
| 13 | 13 |
| 14 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { | 14 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 GpuChannelHost::~GpuChannelHost() { | 17 GpuChannelHost::~GpuChannelHost() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) { | 20 void GpuChannelHost::Connect( |
| 21 const IPC::ChannelHandle& channel_handle, | |
| 22 base::ProcessHandle gpu_renderer_process) { | |
| 21 // Open a channel to the GPU process. | 23 // Open a channel to the GPU process. |
| 22 channel_.reset(new IPC::SyncChannel( | 24 channel_.reset(new IPC::SyncChannel( |
| 23 channel_handle, IPC::Channel::MODE_CLIENT, this, | 25 channel_handle, IPC::Channel::MODE_CLIENT, this, |
| 24 ChildProcess::current()->io_message_loop(), true, | 26 ChildProcess::current()->io_message_loop(), true, |
| 25 ChildProcess::current()->GetShutDownEvent())); | 27 ChildProcess::current()->GetShutDownEvent())); |
| 26 | 28 |
| 27 // It is safe to send IPC messages before the channel completes the connection | 29 // It is safe to send IPC messages before the channel completes the connection |
| 28 // and receives the hello message from the GPU process. The messages get | 30 // and receives the hello message from the GPU process. The messages get |
| 29 // cached. | 31 // cached. |
| 30 state_ = kConnected; | 32 state_ = kConnected; |
| 33 | |
| 34 // Notify the GPU process of out process handle. This gives it the ability | |
|
Ken Russell (switch to Gerrit)
2011/02/24 19:48:47
out -> our
| |
| 35 // to map renderer handles into the GPU process. | |
| 36 Send(new GpuChannelMsg_Initialize(gpu_renderer_process)); | |
| 31 } | 37 } |
| 32 | 38 |
| 33 void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) { | 39 void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) { |
| 34 gpu_info_ = gpu_info; | 40 gpu_info_ = gpu_info; |
| 35 } | 41 } |
| 36 | 42 |
| 37 const GPUInfo& GpuChannelHost::gpu_info() const { | 43 const GPUInfo& GpuChannelHost::gpu_info() const { |
| 38 return gpu_info_; | 44 return gpu_info_; |
| 39 } | 45 } |
| 40 | 46 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // Check the proxy has not already been removed after a channel error. | 166 // Check the proxy has not already been removed after a channel error. |
| 161 int route_id = command_buffer->route_id(); | 167 int route_id = command_buffer->route_id(); |
| 162 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 168 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
| 163 proxies_.erase(route_id); | 169 proxies_.erase(route_id); |
| 164 router_.RemoveRoute(route_id); | 170 router_.RemoveRoute(route_id); |
| 165 } | 171 } |
| 166 | 172 |
| 167 delete command_buffer; | 173 delete command_buffer; |
| 168 #endif | 174 #endif |
| 169 } | 175 } |
| OLD | NEW |