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/gpu_channel_host.h" | 5 #include "content/renderer/gpu/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/gpu/command_buffer_proxy.h" | 9 #include "content/renderer/gpu/command_buffer_proxy.h" |
10 #include "content/renderer/gpu/gpu_surface_proxy.h" | 10 #include "content/renderer/gpu/gpu_surface_proxy.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 132 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
133 router_.AddRoute(route_id, command_buffer); | 133 router_.AddRoute(route_id, command_buffer); |
134 proxies_[route_id] = command_buffer; | 134 proxies_[route_id] = command_buffer; |
135 return command_buffer; | 135 return command_buffer; |
136 #else | 136 #else |
137 return NULL; | 137 return NULL; |
138 #endif | 138 #endif |
139 } | 139 } |
140 | 140 |
141 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( | 141 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( |
142 CommandBufferProxy* parent, | |
143 const gfx::Size& size, | 142 const gfx::Size& size, |
144 const std::string& allowed_extensions, | 143 const std::string& allowed_extensions, |
145 const std::vector<int32>& attribs, | 144 const std::vector<int32>& attribs, |
146 uint32 parent_texture_id, | |
147 const GURL& active_url) { | 145 const GURL& active_url) { |
148 #if defined(ENABLE_GPU) | 146 #if defined(ENABLE_GPU) |
149 // An error occurred. Need to get the host again to reinitialize it. | 147 // An error occurred. Need to get the host again to reinitialize it. |
150 if (!channel_.get()) | 148 if (!channel_.get()) |
151 return NULL; | 149 return NULL; |
152 | 150 |
153 GPUCreateCommandBufferConfig init_params; | 151 GPUCreateCommandBufferConfig init_params; |
154 init_params.allowed_extensions = allowed_extensions; | 152 init_params.allowed_extensions = allowed_extensions; |
155 init_params.attribs = attribs; | 153 init_params.attribs = attribs; |
156 init_params.active_url = active_url; | 154 init_params.active_url = active_url; |
157 int32 parent_route_id = parent ? parent->route_id() : 0; | |
158 int32 route_id; | 155 int32 route_id; |
159 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(parent_route_id, | 156 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, |
160 size, | |
161 init_params, | 157 init_params, |
162 parent_texture_id, | |
163 &route_id))) { | 158 &route_id))) { |
164 return NULL; | 159 return NULL; |
165 } | 160 } |
166 | 161 |
167 if (route_id == MSG_ROUTING_NONE) | 162 if (route_id == MSG_ROUTING_NONE) |
168 return NULL; | 163 return NULL; |
169 | 164 |
170 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 165 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
171 router_.AddRoute(route_id, command_buffer); | 166 router_.AddRoute(route_id, command_buffer); |
172 proxies_[route_id] = command_buffer; | 167 proxies_[route_id] = command_buffer; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 201 |
207 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { | 202 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { |
208 #if defined(ENABLE_GPU) | 203 #if defined(ENABLE_GPU) |
209 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); | 204 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); |
210 if (router_.ResolveRoute(surface->route_id())) | 205 if (router_.ResolveRoute(surface->route_id())) |
211 router_.RemoveRoute(surface->route_id()); | 206 router_.RemoveRoute(surface->route_id()); |
212 | 207 |
213 delete surface; | 208 delete surface; |
214 #endif | 209 #endif |
215 } | 210 } |
OLD | NEW |