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

Side by Side Diff: chrome/browser/chromeos/arc/gpu_arc_video_service_host.cc

Issue 1641353003: GpuArcVideoService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@arc-4-owen-ArcGpuVideoDecodeAccelerator
Patch Set: fix build Created 4 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
« no previous file with comments | « chrome/browser/chromeos/arc/gpu_arc_video_service_host.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/arc/gpu_arc_video_service_host.h"
6
7 #include "base/location.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/gpu_service_registry.h"
13 #include "content/public/common/service_registry.h"
14
15 namespace {
16
17 mojo::InterfacePtrInfo<arc::VideoHost> GetServiceOnIOThread() {
18 arc::VideoHostPtr host_ptr;
19 content::ServiceRegistry* registry = content::GetGpuServiceRegistry();
20 registry->ConnectToRemoteService(mojo::GetProxy(&host_ptr));
21
22 // Unbind and reply back to UI thread.
23 return host_ptr.PassInterface();
24 }
25
26 } // namespace
27
28 namespace arc {
29
30 GpuArcVideoServiceHost::GpuArcVideoServiceHost(
31 arc::ArcBridgeService* bridge_service)
32 : ArcService(bridge_service), binding_(this), weak_factory_(this) {
33 arc_bridge_service()->AddObserver(this);
34 }
35
36 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() {
37 DCHECK(thread_checker_.CalledOnValidThread());
38 arc_bridge_service()->RemoveObserver(this);
39 }
40
41 void GpuArcVideoServiceHost::OnVideoInstanceReady() {
42 DCHECK(thread_checker_.CalledOnValidThread());
43 auto video_instance = arc_bridge_service()->video_instance();
44 DCHECK(video_instance);
45 video_instance->Init(binding_.CreateInterfacePtrAndBind());
46 }
47
48 void GpuArcVideoServiceHost::OnVideoInstanceClosed() {
49 DCHECK(thread_checker_.CalledOnValidThread());
50 service_ptr_.reset();
51 }
52
53 void GpuArcVideoServiceHost::OnRequestArcVideoAcceleratorChannel(
54 const OnRequestArcVideoAcceleratorChannelCallback& callback) {
55 DCHECK(thread_checker_.CalledOnValidThread());
56
57 content::BrowserThread::PostTaskAndReplyWithResult(
58 content::BrowserThread::IO, FROM_HERE, base::Bind(&GetServiceOnIOThread),
59 base::Bind(&GpuArcVideoServiceHost::BindServiceAndCreateChannel,
60 weak_factory_.GetWeakPtr(), callback));
61 }
62
63 void GpuArcVideoServiceHost::BindServiceAndCreateChannel(
64 const OnRequestArcVideoAcceleratorChannelCallback& callback,
65 mojo::InterfacePtrInfo<arc::VideoHost> ptr_info) {
66 DCHECK(thread_checker_.CalledOnValidThread());
67
68 service_ptr_.Bind(std::move(ptr_info));
69 service_ptr_->OnRequestArcVideoAcceleratorChannel(callback);
70 }
71
72 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/gpu_arc_video_service_host.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698