OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/gpu_channel_host.h" | 5 #include "content/renderer/gpu_channel_host.h" |
6 | 6 |
7 #include "content/common/child_process.h" | 7 #include "content/common/child_process.h" |
8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
9 #include "content/renderer/command_buffer_proxy.h" | 9 #include "content/renderer/command_buffer_proxy.h" |
10 #include "content/renderer/gpu_video_service_host.h" | 10 #include "content/renderer/gpu_video_service_host.h" |
11 #include "content/renderer/render_thread.h" | 11 #include "content/renderer/render_thread.h" |
12 #include "content/renderer/transport_texture_service.h" | 12 #include "content/renderer/transport_texture_service.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 | 14 |
15 GpuChannelHost::GpuChannelHost() | 15 GpuChannelHost::GpuChannelHost() |
16 : state_(kUnconnected), | 16 : state_(kUnconnected), |
17 gpu_video_service_host_(new GpuVideoServiceHost()), | 17 gpu_video_service_host_(new GpuVideoServiceHost()), |
18 transport_texture_service_(new TransportTextureService()) { | 18 transport_texture_service_(new TransportTextureService()) { |
19 } | 19 } |
20 | 20 |
21 GpuChannelHost::~GpuChannelHost() { | 21 GpuChannelHost::~GpuChannelHost() { |
22 } | 22 } |
23 | 23 |
24 void GpuChannelHost::Connect( | 24 void GpuChannelHost::Connect( |
25 const IPC::ChannelHandle& channel_handle, | 25 const IPC::ChannelHandle& channel_handle, |
26 base::ProcessHandle renderer_process_for_gpu) { | 26 base::ProcessHandle renderer_process_for_gpu) { |
27 // Open a channel to the GPU process. | 27 // Open a channel to the GPU process. |
28 channel_.reset(new IPC::SyncChannel( | 28 channel_.reset(new IPC::SyncChannel( |
29 channel_handle, IPC::Channel::MODE_CLIENT, this, | 29 channel_handle, IPC::Channel::MODE_CLIENT, this, |
30 ChildProcess::current()->io_message_loop(), true, | 30 ChildProcess::current()->io_message_loop_proxy(), true, |
31 ChildProcess::current()->GetShutDownEvent())); | 31 ChildProcess::current()->GetShutDownEvent())); |
32 | 32 |
33 // It is safe to send IPC messages before the channel completes the connection | 33 // It is safe to send IPC messages before the channel completes the connection |
34 // and receives the hello message from the GPU process. The messages get | 34 // and receives the hello message from the GPU process. The messages get |
35 // cached. | 35 // cached. |
36 state_ = kConnected; | 36 state_ = kConnected; |
37 | 37 |
38 // Notify the GPU process of our process handle. This gives it the ability | 38 // Notify the GPU process of our process handle. This gives it the ability |
39 // to map renderer handles into the GPU process. | 39 // to map renderer handles into the GPU process. |
40 Send(new GpuChannelMsg_Initialize(renderer_process_for_gpu)); | 40 Send(new GpuChannelMsg_Initialize(renderer_process_for_gpu)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Check the proxy has not already been removed after a channel error. | 179 // Check the proxy has not already been removed after a channel error. |
180 int route_id = command_buffer->route_id(); | 180 int route_id = command_buffer->route_id(); |
181 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 181 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
182 proxies_.erase(route_id); | 182 proxies_.erase(route_id); |
183 router_.RemoveRoute(route_id); | 183 router_.RemoveRoute(route_id); |
184 } | 184 } |
185 | 185 |
186 delete command_buffer; | 186 delete command_buffer; |
187 #endif | 187 #endif |
188 } | 188 } |
OLD | NEW |