OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 new CommandBufferProxyImpl(this, route_id); | 173 new CommandBufferProxyImpl(this, route_id); |
174 AddRoute(route_id, command_buffer->AsWeakPtr()); | 174 AddRoute(route_id, command_buffer->AsWeakPtr()); |
175 | 175 |
176 AutoLock lock(context_lock_); | 176 AutoLock lock(context_lock_); |
177 proxies_[route_id] = command_buffer; | 177 proxies_[route_id] = command_buffer; |
178 return command_buffer; | 178 return command_buffer; |
179 } | 179 } |
180 | 180 |
181 scoped_ptr<media::VideoDecodeAccelerator> GpuChannelHost::CreateVideoDecoder( | 181 scoped_ptr<media::VideoDecodeAccelerator> GpuChannelHost::CreateVideoDecoder( |
182 int command_buffer_route_id, | 182 int command_buffer_route_id, |
183 media::VideoCodecProfile profile, | 183 media::VideoCodecProfile profile) { |
184 media::VideoDecodeAccelerator::Client* client) { | |
185 AutoLock lock(context_lock_); | 184 AutoLock lock(context_lock_); |
186 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 185 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
187 DCHECK(it != proxies_.end()); | 186 DCHECK(it != proxies_.end()); |
188 CommandBufferProxyImpl* proxy = it->second; | 187 CommandBufferProxyImpl* proxy = it->second; |
189 return proxy->CreateVideoDecoder(profile, client).Pass(); | 188 return proxy->CreateVideoDecoder(profile).Pass(); |
190 } | 189 } |
191 | 190 |
192 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( | 191 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder() { |
193 media::VideoEncodeAccelerator::Client* client) { | |
194 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); | 192 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); |
195 | 193 |
196 scoped_ptr<media::VideoEncodeAccelerator> vea; | 194 scoped_ptr<media::VideoEncodeAccelerator> vea; |
197 int32 route_id = MSG_ROUTING_NONE; | 195 int32 route_id = MSG_ROUTING_NONE; |
198 if (!Send(new GpuChannelMsg_CreateVideoEncoder(&route_id))) | 196 if (!Send(new GpuChannelMsg_CreateVideoEncoder(&route_id))) |
199 return vea.Pass(); | 197 return vea.Pass(); |
200 if (route_id == MSG_ROUTING_NONE) | 198 if (route_id == MSG_ROUTING_NONE) |
201 return vea.Pass(); | 199 return vea.Pass(); |
202 | 200 |
203 vea.reset(new GpuVideoEncodeAcceleratorHost(client, this, route_id)); | 201 vea.reset(new GpuVideoEncodeAcceleratorHost(this, route_id)); |
204 return vea.Pass(); | 202 return vea.Pass(); |
205 } | 203 } |
206 | 204 |
207 void GpuChannelHost::DestroyCommandBuffer( | 205 void GpuChannelHost::DestroyCommandBuffer( |
208 CommandBufferProxyImpl* command_buffer) { | 206 CommandBufferProxyImpl* command_buffer) { |
209 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 207 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
210 | 208 |
211 int route_id = command_buffer->GetRouteID(); | 209 int route_id = command_buffer->GetRouteID(); |
212 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 210 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
213 RemoveRoute(route_id); | 211 RemoveRoute(route_id); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 358 |
361 listeners_.clear(); | 359 listeners_.clear(); |
362 } | 360 } |
363 | 361 |
364 bool GpuChannelHost::MessageFilter::IsLost() const { | 362 bool GpuChannelHost::MessageFilter::IsLost() const { |
365 AutoLock lock(lock_); | 363 AutoLock lock(lock_); |
366 return lost_; | 364 return lost_; |
367 } | 365 } |
368 | 366 |
369 } // namespace content | 367 } // namespace content |
OLD | NEW |