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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 173 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
174 router_.AddRoute(route_id, command_buffer); | 174 router_.AddRoute(route_id, command_buffer); |
175 proxies_[route_id] = command_buffer; | 175 proxies_[route_id] = command_buffer; |
176 return command_buffer; | 176 return command_buffer; |
177 #else | 177 #else |
178 return NULL; | 178 return NULL; |
179 #endif | 179 #endif |
180 } | 180 } |
181 | 181 |
| 182 void GpuChannelHost::AddRoute(int32 route_id, |
| 183 IPC::Channel::Listener* listener) { |
| 184 router_.AddRoute(route_id, listener); |
| 185 } |
| 186 |
| 187 void GpuChannelHost::RemoveRoute(int32 route_id) { |
| 188 router_.RemoveRoute(route_id); |
| 189 } |
| 190 |
182 void GpuChannelHost::DestroyCommandBuffer(CommandBufferProxy* command_buffer) { | 191 void GpuChannelHost::DestroyCommandBuffer(CommandBufferProxy* command_buffer) { |
183 #if defined(ENABLE_GPU) | 192 #if defined(ENABLE_GPU) |
184 Send(new GpuChannelMsg_DestroyCommandBuffer(command_buffer->route_id())); | 193 Send(new GpuChannelMsg_DestroyCommandBuffer(command_buffer->route_id())); |
185 | 194 |
186 // Check the proxy has not already been removed after a channel error. | 195 // Check the proxy has not already been removed after a channel error. |
187 int route_id = command_buffer->route_id(); | 196 int route_id = command_buffer->route_id(); |
188 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 197 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
189 proxies_.erase(route_id); | 198 proxies_.erase(route_id); |
190 router_.RemoveRoute(route_id); | 199 router_.RemoveRoute(route_id); |
191 } | 200 } |
(...skipping 17 matching lines...) Expand all Loading... |
209 | 218 |
210 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { | 219 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { |
211 #if defined(ENABLE_GPU) | 220 #if defined(ENABLE_GPU) |
212 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); | 221 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); |
213 if (router_.ResolveRoute(surface->route_id())) | 222 if (router_.ResolveRoute(surface->route_id())) |
214 router_.RemoveRoute(surface->route_id()); | 223 router_.RemoveRoute(surface->route_id()); |
215 | 224 |
216 delete surface; | 225 delete surface; |
217 #endif | 226 #endif |
218 } | 227 } |
OLD | NEW |