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

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

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix many thread issues Created 5 years, 8 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
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/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/posix/eintr_wrapper.h" 12 #include "base/posix/eintr_wrapper.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.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_jpeg_decode_accelerator_host.h"
16 #include "content/common/gpu/gpu_messages.h" 17 #include "content/common/gpu/gpu_messages.h"
17 #include "ipc/ipc_sync_message_filter.h" 18 #include "ipc/ipc_sync_message_filter.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 #if defined(OS_WIN) 21 #if defined(OS_WIN)
21 #include "content/public/common/sandbox_init.h" 22 #include "content/public/common/sandbox_init.h"
22 #endif 23 #endif
23 24
24 using base::AutoLock; 25 using base::AutoLock;
25 using base::MessageLoopProxy; 26 using base::MessageLoopProxy;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 MessageLoopProxy::current())); 291 MessageLoopProxy::current()));
291 } 292 }
292 293
293 void GpuChannelHost::RemoveRoute(int route_id) { 294 void GpuChannelHost::RemoveRoute(int route_id) {
294 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); 295 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
295 io_loop->PostTask(FROM_HERE, 296 io_loop->PostTask(FROM_HERE,
296 base::Bind(&GpuChannelHost::MessageFilter::RemoveRoute, 297 base::Bind(&GpuChannelHost::MessageFilter::RemoveRoute,
297 channel_filter_.get(), route_id)); 298 channel_filter_.get(), route_id));
298 } 299 }
299 300
301 GpuJpegDecodeAcceleratorHost* GpuChannelHost::CreateJpegDecoder() {
302 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder");
303
304 int32 route_id = GenerateRouteID();
305 GpuJpegDecodeAcceleratorHost* decoder =
306 new GpuJpegDecodeAcceleratorHost(this, route_id);
307
308 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
309 io_loop->PostTask(FROM_HERE,
310 base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
311 channel_filter_.get(), route_id, decoder->AsWeakP tr(),
wuchengli 2015/04/14 09:41:44 80 char align?
kcwu 2015/04/14 20:02:35 Done.
312 io_loop));
313 return decoder;
314 }
315
300 base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess( 316 base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess(
301 base::SharedMemoryHandle source_handle) { 317 base::SharedMemoryHandle source_handle) {
302 if (IsLost()) 318 if (IsLost())
303 return base::SharedMemory::NULLHandle(); 319 return base::SharedMemory::NULLHandle();
304 320
305 #if defined(OS_WIN) 321 #if defined(OS_WIN)
306 // Windows needs to explicitly duplicate the handle out to another process. 322 // Windows needs to explicitly duplicate the handle out to another process.
307 base::SharedMemoryHandle target_handle; 323 base::SharedMemoryHandle target_handle;
308 if (!BrokerDuplicateHandle(source_handle, 324 if (!BrokerDuplicateHandle(source_handle,
309 channel_->GetPeerPID(), 325 channel_->GetPeerPID(),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 442
427 listeners_.clear(); 443 listeners_.clear();
428 } 444 }
429 445
430 bool GpuChannelHost::MessageFilter::IsLost() const { 446 bool GpuChannelHost::MessageFilter::IsLost() const {
431 AutoLock lock(lock_); 447 AutoLock lock(lock_);
432 return lost_; 448 return lost_;
433 } 449 }
434 450
435 } // namespace content 451 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698