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/gpu_create_command_buffer_config.h" | |
8 #include "chrome/common/gpu_messages.h" | |
9 #include "chrome/renderer/command_buffer_proxy.h" | 7 #include "chrome/renderer/command_buffer_proxy.h" |
10 #include "chrome/renderer/gpu_video_service_host.h" | 8 #include "chrome/renderer/gpu_video_service_host.h" |
11 #include "chrome/renderer/render_thread.h" | 9 #include "chrome/renderer/render_thread.h" |
12 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
| 11 #include "content/common/gpu_messages.h" |
13 | 12 |
14 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { | 13 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { |
15 } | 14 } |
16 | 15 |
17 GpuChannelHost::~GpuChannelHost() { | 16 GpuChannelHost::~GpuChannelHost() { |
18 } | 17 } |
19 | 18 |
20 void GpuChannelHost::Connect( | 19 void GpuChannelHost::Connect( |
21 const IPC::ChannelHandle& channel_handle, | 20 const IPC::ChannelHandle& channel_handle, |
22 base::ProcessHandle renderer_process_for_gpu) { | 21 base::ProcessHandle renderer_process_for_gpu) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 97 |
99 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 98 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( |
100 int render_view_id, | 99 int render_view_id, |
101 const std::string& allowed_extensions, | 100 const std::string& allowed_extensions, |
102 const std::vector<int32>& attribs) { | 101 const std::vector<int32>& attribs) { |
103 #if defined(ENABLE_GPU) | 102 #if defined(ENABLE_GPU) |
104 // An error occurred. Need to get the host again to reinitialize it. | 103 // An error occurred. Need to get the host again to reinitialize it. |
105 if (!channel_.get()) | 104 if (!channel_.get()) |
106 return NULL; | 105 return NULL; |
107 | 106 |
108 GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); | 107 GPUCreateCommandBufferConfig init_params; |
| 108 init_params.allowed_extensions = allowed_extensions; |
| 109 init_params.attribs = attribs; |
109 int32 route_id; | 110 int32 route_id; |
110 if (!RenderThread::current()->Send( | 111 if (!RenderThread::current()->Send( |
111 new GpuHostMsg_CreateViewCommandBuffer( | 112 new GpuHostMsg_CreateViewCommandBuffer( |
112 render_view_id, init_params, &route_id))) { | 113 render_view_id, init_params, &route_id))) { |
113 return NULL; | 114 return NULL; |
114 } | 115 } |
115 | 116 |
116 if (route_id == MSG_ROUTING_NONE) | 117 if (route_id == MSG_ROUTING_NONE) |
117 return NULL; | 118 return NULL; |
118 | 119 |
(...skipping 10 matching lines...) Expand all Loading... |
129 CommandBufferProxy* parent, | 130 CommandBufferProxy* parent, |
130 const gfx::Size& size, | 131 const gfx::Size& size, |
131 const std::string& allowed_extensions, | 132 const std::string& allowed_extensions, |
132 const std::vector<int32>& attribs, | 133 const std::vector<int32>& attribs, |
133 uint32 parent_texture_id) { | 134 uint32 parent_texture_id) { |
134 #if defined(ENABLE_GPU) | 135 #if defined(ENABLE_GPU) |
135 // An error occurred. Need to get the host again to reinitialize it. | 136 // An error occurred. Need to get the host again to reinitialize it. |
136 if (!channel_.get()) | 137 if (!channel_.get()) |
137 return NULL; | 138 return NULL; |
138 | 139 |
139 GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); | 140 GPUCreateCommandBufferConfig init_params; |
| 141 init_params.allowed_extensions = allowed_extensions; |
| 142 init_params.attribs = attribs; |
140 int32 parent_route_id = parent ? parent->route_id() : 0; | 143 int32 parent_route_id = parent ? parent->route_id() : 0; |
141 int32 route_id; | 144 int32 route_id; |
142 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(parent_route_id, | 145 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(parent_route_id, |
143 size, | 146 size, |
144 init_params, | 147 init_params, |
145 parent_texture_id, | 148 parent_texture_id, |
146 &route_id))) { | 149 &route_id))) { |
147 return NULL; | 150 return NULL; |
148 } | 151 } |
149 | 152 |
(...skipping 16 matching lines...) Expand all Loading... |
166 // Check the proxy has not already been removed after a channel error. | 169 // Check the proxy has not already been removed after a channel error. |
167 int route_id = command_buffer->route_id(); | 170 int route_id = command_buffer->route_id(); |
168 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 171 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
169 proxies_.erase(route_id); | 172 proxies_.erase(route_id); |
170 router_.RemoveRoute(route_id); | 173 router_.RemoveRoute(route_id); |
171 } | 174 } |
172 | 175 |
173 delete command_buffer; | 176 delete command_buffer; |
174 #endif | 177 #endif |
175 } | 178 } |
OLD | NEW |