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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 state_ = kLost; | 53 state_ = kLost; |
54 } | 54 } |
55 | 55 |
56 bool GpuChannelHost::OnMessageReceived(const IPC::Message& message) { | 56 bool GpuChannelHost::OnMessageReceived(const IPC::Message& message) { |
57 DCHECK(message.routing_id() != MSG_ROUTING_CONTROL); | 57 DCHECK(message.routing_id() != MSG_ROUTING_CONTROL); |
58 | 58 |
59 // The object to which the message is addressed might have been destroyed. | 59 // The object to which the message is addressed might have been destroyed. |
60 // This is expected, for example an asynchronous SwapBuffers notification | 60 // This is expected, for example an asynchronous SwapBuffers notification |
61 // to a command buffer proxy that has since been destroyed. This function | 61 // to a command buffer proxy that has since been destroyed. This function |
62 // fails silently in that case. | 62 // fails silently in that case. |
| 63 if (gpu_video_service_host_->OnMessageReceived(message)) |
| 64 return true; |
63 return router_.RouteMessage(message); | 65 return router_.RouteMessage(message); |
64 } | 66 } |
65 | 67 |
66 void GpuChannelHost::OnChannelConnected(int32 peer_pid) { | 68 void GpuChannelHost::OnChannelConnected(int32 peer_pid) { |
67 // When the channel is connected we create a GpuVideoServiceHost and add it | |
68 // as a message filter. | |
69 channel_->AddFilter(gpu_video_service_host_.get()); | |
70 channel_->AddFilter(transport_texture_service_.get()); | 69 channel_->AddFilter(transport_texture_service_.get()); |
| 70 gpu_video_service_host_->set_channel(channel_.get()); |
71 } | 71 } |
72 | 72 |
73 void GpuChannelHost::OnChannelError() { | 73 void GpuChannelHost::OnChannelError() { |
74 state_ = kLost; | 74 state_ = kLost; |
75 | 75 |
76 // Channel is invalid and will be reinitialized if this host is requested | 76 // Channel is invalid and will be reinitialized if this host is requested |
77 // again. | 77 // again. |
78 channel_.reset(); | 78 channel_.reset(); |
79 | 79 |
80 // Inform all the proxies that an error has occured. This will be reported via | 80 // Inform all the proxies that an error has occured. This will be reported via |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { | 201 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { |
202 #if defined(ENABLE_GPU) | 202 #if defined(ENABLE_GPU) |
203 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); | 203 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); |
204 if (router_.ResolveRoute(surface->route_id())) | 204 if (router_.ResolveRoute(surface->route_id())) |
205 router_.RemoveRoute(surface->route_id()); | 205 router_.RemoveRoute(surface->route_id()); |
206 | 206 |
207 delete surface; | 207 delete surface; |
208 #endif | 208 #endif |
209 } | 209 } |
OLD | NEW |