OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/gpu/chrome_content_gpu_client.h" | 5 #include "chrome/gpu/chrome_content_gpu_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "chrome/common/stack_sampling_configuration.h" | 14 #include "chrome/common/stack_sampling_configuration.h" |
15 #include "components/metrics/child_call_stack_profile_collector.h" | 15 #include "components/metrics/child_call_stack_profile_collector.h" |
16 #include "content/public/child/child_thread.h" | 16 #include "content/public/child/child_thread.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/service_names.mojom.h" | 18 #include "content/public/common/service_names.mojom.h" |
19 #include "mojo/public/cpp/bindings/strong_binding.h" | 19 #include "mojo/public/cpp/bindings/strong_binding.h" |
20 #include "services/service_manager/public/cpp/connector.h" | 20 #include "services/service_manager/public/cpp/connector.h" |
21 | 21 |
22 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
23 #include "chrome/gpu/gpu_arc_video_decode_accelerator.h" | 23 #include "chrome/gpu/gpu_arc_video_decode_accelerator.h" |
| 24 #include "chrome/gpu/gpu_arc_video_encode_accelerator.h" |
24 #include "content/public/common/service_manager_connection.h" | 25 #include "content/public/common/service_manager_connection.h" |
25 #include "services/service_manager/public/cpp/binder_registry.h" | 26 #include "services/service_manager/public/cpp/binder_registry.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 base::LazyInstance<metrics::ChildCallStackProfileCollector>::Leaky | 31 base::LazyInstance<metrics::ChildCallStackProfileCollector>::Leaky |
31 g_call_stack_profile_collector = LAZY_INSTANCE_INITIALIZER; | 32 g_call_stack_profile_collector = LAZY_INSTANCE_INITIALIZER; |
32 | 33 |
33 } // namespace | 34 } // namespace |
(...skipping 27 matching lines...) Expand all Loading... |
61 new variations::ChildProcessFieldTrialSyncer(observer)); | 62 new variations::ChildProcessFieldTrialSyncer(observer)); |
62 field_trial_syncer_->InitFieldTrialObserving(command_line, | 63 field_trial_syncer_->InitFieldTrialObserving(command_line, |
63 switches::kSingleProcess); | 64 switches::kSingleProcess); |
64 } | 65 } |
65 | 66 |
66 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
67 registry->AddInterface( | 68 registry->AddInterface( |
68 base::Bind(&ChromeContentGpuClient::CreateArcVideoDecodeAccelerator, | 69 base::Bind(&ChromeContentGpuClient::CreateArcVideoDecodeAccelerator, |
69 base::Unretained(this)), | 70 base::Unretained(this)), |
70 base::ThreadTaskRunnerHandle::Get()); | 71 base::ThreadTaskRunnerHandle::Get()); |
| 72 registry->AddInterface( |
| 73 base::Bind(&ChromeContentGpuClient::CreateArcVideoEncodeAccelerator, |
| 74 base::Unretained(this)), |
| 75 base::ThreadTaskRunnerHandle::Get()); |
71 #endif | 76 #endif |
72 } | 77 } |
73 | 78 |
74 void ChromeContentGpuClient::GpuServiceInitialized( | 79 void ChromeContentGpuClient::GpuServiceInitialized( |
75 const gpu::GpuPreferences& gpu_preferences) { | 80 const gpu::GpuPreferences& gpu_preferences) { |
76 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
77 gpu_preferences_ = gpu_preferences; | 82 gpu_preferences_ = gpu_preferences; |
78 #endif | 83 #endif |
79 | 84 |
80 metrics::mojom::CallStackProfileCollectorPtr browser_interface; | 85 metrics::mojom::CallStackProfileCollectorPtr browser_interface; |
81 content::ChildThread::Get()->GetConnector()->BindInterface( | 86 content::ChildThread::Get()->GetConnector()->BindInterface( |
82 content::mojom::kBrowserServiceName, &browser_interface); | 87 content::mojom::kBrowserServiceName, &browser_interface); |
83 g_call_stack_profile_collector.Get().SetParentProfileCollector( | 88 g_call_stack_profile_collector.Get().SetParentProfileCollector( |
84 std::move(browser_interface)); | 89 std::move(browser_interface)); |
85 } | 90 } |
86 | 91 |
87 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
88 | 93 |
89 void ChromeContentGpuClient::CreateArcVideoDecodeAccelerator( | 94 void ChromeContentGpuClient::CreateArcVideoDecodeAccelerator( |
90 const service_manager::BindSourceInfo& source_info, | 95 const service_manager::BindSourceInfo& source_info, |
91 ::arc::mojom::VideoDecodeAcceleratorRequest request) { | 96 ::arc::mojom::VideoDecodeAcceleratorRequest request) { |
92 mojo::MakeStrongBinding( | 97 mojo::MakeStrongBinding( |
93 base::MakeUnique<chromeos::arc::GpuArcVideoDecodeAccelerator>( | 98 base::MakeUnique<chromeos::arc::GpuArcVideoDecodeAccelerator>( |
94 gpu_preferences_), | 99 gpu_preferences_), |
95 std::move(request)); | 100 std::move(request)); |
96 } | 101 } |
97 | 102 |
| 103 void ChromeContentGpuClient::CreateArcVideoEncodeAccelerator( |
| 104 const service_manager::BindSourceInfo& source_info, |
| 105 ::arc::mojom::VideoEncodeAcceleratorRequest request) { |
| 106 mojo::MakeStrongBinding( |
| 107 base::MakeUnique<chromeos::arc::GpuArcVideoEncodeAccelerator>( |
| 108 gpu_preferences_), |
| 109 std::move(request)); |
| 110 } |
98 #endif | 111 #endif |
OLD | NEW |