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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return channel_->Send(message); | 90 return channel_->Send(message); |
91 | 91 |
92 // Callee takes ownership of message, regardless of whether Send is | 92 // Callee takes ownership of message, regardless of whether Send is |
93 // successful. See IPC::Message::Sender. | 93 // successful. See IPC::Message::Sender. |
94 delete message; | 94 delete message; |
95 return false; | 95 return false; |
96 } | 96 } |
97 | 97 |
98 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 98 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( |
99 int render_view_id, | 99 int render_view_id, |
| 100 CommandBufferProxy* share_group, |
100 const std::string& allowed_extensions, | 101 const std::string& allowed_extensions, |
101 const std::vector<int32>& attribs, | 102 const std::vector<int32>& attribs, |
102 const GURL& active_url) { | 103 const GURL& active_url) { |
103 #if defined(ENABLE_GPU) | 104 #if defined(ENABLE_GPU) |
104 // An error occurred. Need to get the host again to reinitialize it. | 105 // An error occurred. Need to get the host again to reinitialize it. |
105 if (!channel_.get()) | 106 if (!channel_.get()) |
106 return NULL; | 107 return NULL; |
107 | 108 |
108 GPUCreateCommandBufferConfig init_params; | 109 GPUCreateCommandBufferConfig init_params; |
| 110 init_params.share_group_id = |
| 111 share_group ? share_group->route_id() : MSG_ROUTING_NONE; |
109 init_params.allowed_extensions = allowed_extensions; | 112 init_params.allowed_extensions = allowed_extensions; |
110 init_params.attribs = attribs; | 113 init_params.attribs = attribs; |
111 init_params.active_url = active_url; | 114 init_params.active_url = active_url; |
112 int32 route_id; | 115 int32 route_id; |
113 if (!RenderThread::current()->Send( | 116 if (!RenderThread::current()->Send( |
114 new GpuHostMsg_CreateViewCommandBuffer( | 117 new GpuHostMsg_CreateViewCommandBuffer( |
115 render_view_id, init_params, &route_id))) { | 118 render_view_id, |
| 119 init_params, |
| 120 &route_id))) { |
116 return NULL; | 121 return NULL; |
117 } | 122 } |
118 | 123 |
119 if (route_id == MSG_ROUTING_NONE) | 124 if (route_id == MSG_ROUTING_NONE) |
120 return NULL; | 125 return NULL; |
121 | 126 |
122 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 127 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
123 router_.AddRoute(route_id, command_buffer); | 128 router_.AddRoute(route_id, command_buffer); |
124 proxies_[route_id] = command_buffer; | 129 proxies_[route_id] = command_buffer; |
125 return command_buffer; | 130 return command_buffer; |
126 #else | 131 #else |
127 return NULL; | 132 return NULL; |
128 #endif | 133 #endif |
129 } | 134 } |
130 | 135 |
131 GpuVideoDecodeAcceleratorHost* GpuChannelHost::CreateVideoDecoder( | 136 GpuVideoDecodeAcceleratorHost* GpuChannelHost::CreateVideoDecoder( |
132 int command_buffer_route_id, | 137 int command_buffer_route_id, |
133 const std::vector<uint32>& configs, | 138 const std::vector<uint32>& configs, |
134 media::VideoDecodeAccelerator::Client* client) { | 139 media::VideoDecodeAccelerator::Client* client) { |
135 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 140 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
136 DCHECK(it != proxies_.end()); | 141 DCHECK(it != proxies_.end()); |
137 CommandBufferProxy* proxy = it->second; | 142 CommandBufferProxy* proxy = it->second; |
138 return proxy->CreateVideoDecoder(configs, client); | 143 return proxy->CreateVideoDecoder(configs, client); |
139 } | 144 } |
140 | 145 |
141 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( | 146 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( |
142 const gfx::Size& size, | 147 const gfx::Size& size, |
| 148 CommandBufferProxy* share_group, |
143 const std::string& allowed_extensions, | 149 const std::string& allowed_extensions, |
144 const std::vector<int32>& attribs, | 150 const std::vector<int32>& attribs, |
145 const GURL& active_url) { | 151 const GURL& active_url) { |
146 #if defined(ENABLE_GPU) | 152 #if defined(ENABLE_GPU) |
147 // An error occurred. Need to get the host again to reinitialize it. | 153 // An error occurred. Need to get the host again to reinitialize it. |
148 if (!channel_.get()) | 154 if (!channel_.get()) |
149 return NULL; | 155 return NULL; |
150 | 156 |
151 GPUCreateCommandBufferConfig init_params; | 157 GPUCreateCommandBufferConfig init_params; |
| 158 init_params.share_group_id = |
| 159 share_group ? share_group->route_id() : MSG_ROUTING_NONE; |
152 init_params.allowed_extensions = allowed_extensions; | 160 init_params.allowed_extensions = allowed_extensions; |
153 init_params.attribs = attribs; | 161 init_params.attribs = attribs; |
154 init_params.active_url = active_url; | 162 init_params.active_url = active_url; |
155 int32 route_id; | 163 int32 route_id; |
156 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, | 164 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, |
157 init_params, | 165 init_params, |
158 &route_id))) { | 166 &route_id))) { |
159 return NULL; | 167 return NULL; |
160 } | 168 } |
161 | 169 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 209 |
202 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { | 210 void GpuChannelHost::DestroySurface(GpuSurfaceProxy* surface) { |
203 #if defined(ENABLE_GPU) | 211 #if defined(ENABLE_GPU) |
204 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); | 212 Send(new GpuChannelMsg_DestroySurface(surface->route_id())); |
205 if (router_.ResolveRoute(surface->route_id())) | 213 if (router_.ResolveRoute(surface->route_id())) |
206 router_.RemoveRoute(surface->route_id()); | 214 router_.RemoveRoute(surface->route_id()); |
207 | 215 |
208 delete surface; | 216 delete surface; |
209 #endif | 217 #endif |
210 } | 218 } |
OLD | NEW |