| 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_surface_proxy.h" |
| 10 #include "content/renderer/gpu_video_service_host.h" | 11 #include "content/renderer/gpu_video_service_host.h" |
| 11 #include "content/renderer/render_thread.h" | 12 #include "content/renderer/render_thread.h" |
| 12 #include "content/renderer/transport_texture_service.h" | 13 #include "content/renderer/transport_texture_service.h" |
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 14 | 15 |
| 15 GpuChannelHost::GpuChannelHost() | 16 GpuChannelHost::GpuChannelHost() |
| 16 : state_(kUnconnected), | 17 : state_(kUnconnected), |
| 17 gpu_video_service_host_(new GpuVideoServiceHost()), | 18 gpu_video_service_host_(new GpuVideoServiceHost()), |
| 18 transport_texture_service_(new TransportTextureService()) { | 19 transport_texture_service_(new TransportTextureService()) { |
| 19 } | 20 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Check the proxy has not already been removed after a channel error. | 180 // Check the proxy has not already been removed after a channel error. |
| 180 int route_id = command_buffer->route_id(); | 181 int route_id = command_buffer->route_id(); |
| 181 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 182 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
| 182 proxies_.erase(route_id); | 183 proxies_.erase(route_id); |
| 183 router_.RemoveRoute(route_id); | 184 router_.RemoveRoute(route_id); |
| 184 } | 185 } |
| 185 | 186 |
| 186 delete command_buffer; | 187 delete command_buffer; |
| 187 #endif | 188 #endif |
| 188 } | 189 } |
| 190 |
| 191 GpuSurfaceProxy* GpuChannelHost::CreateOffscreenSurface(const gfx::Size& size) { |
| 192 #if defined(ENABLE_GPU) |
| 193 int route_id; |
| 194 if (!Send(new GpuChannelMsg_CreateOffscreenSurface(size, &route_id))) |
| 195 return NULL; |
| 196 |
| 197 scoped_ptr<GpuSurfaceProxy> surface(new GpuSurfaceProxy(this, route_id)); |
| 198 router_.AddRoute(route_id, surface.get()); |
| 199 |
| 200 return surface.release(); |
| 201 #endif |
| 202 } |
| 203 |
| 204 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { |
| 205 #if defined(ENABLE_GPU) |
| 206 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); |
| 207 if (router_.ResolveRoute(surface->route_id())) |
| 208 router_.RemoveRoute(surface->route_id()); |
| 209 |
| 210 delete surface; |
| 211 #endif |
| 212 } |
| OLD | NEW |