Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 56683e7a Rebase. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/message_loop/message_loop_proxy.h"
13 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" 15 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
16 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
17 #include "content/common/gpu/gpu_messages.h" 16 #include "content/common/gpu/gpu_messages.h"
18 #include "ipc/ipc_sync_message_filter.h" 17 #include "ipc/ipc_sync_message_filter.h"
19 #include "url/gurl.h" 18 #include "url/gurl.h"
20 19
21 #if defined(OS_WIN) 20 #if defined(OS_WIN)
22 #include "content/public/common/sandbox_init.h" 21 #include "content/public/common/sandbox_init.h"
23 #endif 22 #endif
24 23
25 using base::AutoLock; 24 using base::AutoLock;
26 using base::MessageLoopProxy; 25 using base::MessageLoopProxy;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 CommandBufferProxyImpl* command_buffer = 171 CommandBufferProxyImpl* command_buffer =
173 new CommandBufferProxyImpl(this, route_id); 172 new CommandBufferProxyImpl(this, route_id);
174 AddRoute(route_id, command_buffer->AsWeakPtr()); 173 AddRoute(route_id, command_buffer->AsWeakPtr());
175 174
176 AutoLock lock(context_lock_); 175 AutoLock lock(context_lock_);
177 proxies_[route_id] = command_buffer; 176 proxies_[route_id] = command_buffer;
178 return command_buffer; 177 return command_buffer;
179 } 178 }
180 179
181 scoped_ptr<media::VideoDecodeAccelerator> GpuChannelHost::CreateVideoDecoder( 180 scoped_ptr<media::VideoDecodeAccelerator> GpuChannelHost::CreateVideoDecoder(
182 int command_buffer_route_id, 181 int command_buffer_route_id) {
183 media::VideoCodecProfile profile) { 182 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoDecoder");
184 AutoLock lock(context_lock_); 183 AutoLock lock(context_lock_);
185 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); 184 ProxyMap::iterator it = proxies_.find(command_buffer_route_id);
186 DCHECK(it != proxies_.end()); 185 DCHECK(it != proxies_.end());
187 CommandBufferProxyImpl* proxy = it->second; 186 return it->second->CreateVideoDecoder();
188 return proxy->CreateVideoDecoder(profile).Pass();
189 } 187 }
190 188
191 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder() { 189 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder(
190 int command_buffer_route_id) {
192 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); 191 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder");
193 192 AutoLock lock(context_lock_);
194 scoped_ptr<media::VideoEncodeAccelerator> vea; 193 ProxyMap::iterator it = proxies_.find(command_buffer_route_id);
195 int32 route_id = MSG_ROUTING_NONE; 194 DCHECK(it != proxies_.end());
Pawel Osciak 2014/03/13 06:18:13 DCHECK_NE ?
sheu 2014/03/13 22:39:52 Usually, but in this case having the iterator poin
196 if (!Send(new GpuChannelMsg_CreateVideoEncoder(&route_id))) 195 return it->second->CreateVideoEncoder();
197 return vea.Pass();
198 if (route_id == MSG_ROUTING_NONE)
199 return vea.Pass();
200
201 vea.reset(new GpuVideoEncodeAcceleratorHost(this, route_id));
202 return vea.Pass();
203 } 196 }
204 197
205 void GpuChannelHost::DestroyCommandBuffer( 198 void GpuChannelHost::DestroyCommandBuffer(
206 CommandBufferProxyImpl* command_buffer) { 199 CommandBufferProxyImpl* command_buffer) {
207 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); 200 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer");
208 201
209 int route_id = command_buffer->GetRouteID(); 202 int route_id = command_buffer->GetRouteID();
210 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); 203 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id));
211 RemoveRoute(route_id); 204 RemoveRoute(route_id);
212 205
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 351
359 listeners_.clear(); 352 listeners_.clear();
360 } 353 }
361 354
362 bool GpuChannelHost::MessageFilter::IsLost() const { 355 bool GpuChannelHost::MessageFilter::IsLost() const {
363 AutoLock lock(lock_); 356 AutoLock lock(lock_);
364 return lost_; 357 return lost_;
365 } 358 }
366 359
367 } // namespace content 360 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698