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 | 12 |
13 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { | 13 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { |
14 } | 14 } |
15 | 15 |
16 GpuChannelHost::~GpuChannelHost() { | 16 GpuChannelHost::~GpuChannelHost() { |
17 } | 17 } |
18 | 18 |
19 void GpuChannelHost::Connect(const std::string& channel_name) { | 19 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) { |
20 // Open a channel to the GPU process. | 20 // Open a channel to the GPU process. |
21 channel_.reset(new IPC::SyncChannel( | 21 channel_.reset(new IPC::SyncChannel( |
22 channel_name, IPC::Channel::MODE_CLIENT, this, | 22 channel_handle, IPC::Channel::MODE_CLIENT, this, |
23 ChildProcess::current()->io_message_loop(), true, | 23 ChildProcess::current()->io_message_loop(), true, |
24 ChildProcess::current()->GetShutDownEvent())); | 24 ChildProcess::current()->GetShutDownEvent())); |
25 | 25 |
26 // It is safe to send IPC messages before the channel completes the connection | 26 // It is safe to send IPC messages before the channel completes the connection |
27 // and receives the hello message from the GPU process. The messages get | 27 // and receives the hello message from the GPU process. The messages get |
28 // cached. | 28 // cached. |
29 state_ = kConnected; | 29 state_ = kConnected; |
30 } | 30 } |
31 | 31 |
32 void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) { | 32 void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Check the proxy has not already been removed after a channel error. | 157 // Check the proxy has not already been removed after a channel error. |
158 int route_id = command_buffer->route_id(); | 158 int route_id = command_buffer->route_id(); |
159 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 159 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
160 proxies_.erase(route_id); | 160 proxies_.erase(route_id); |
161 router_.RemoveRoute(route_id); | 161 router_.RemoveRoute(route_id); |
162 } | 162 } |
163 | 163 |
164 delete command_buffer; | 164 delete command_buffer; |
165 #endif | 165 #endif |
166 } | 166 } |
OLD | NEW |