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

Side by Side Diff: chrome/gpu/chrome_content_gpu_client.cc

Issue 2819903004: Migrate GpuChildThread to use ConnectionFilter instead of the ChildThread's InterfaceRegistry to exp (Closed)
Patch Set: . Created 3 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 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/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "content/public/common/service_names.mojom.h" 18 #include "content/public/common/service_names.mojom.h"
18 #include "mojo/public/cpp/bindings/strong_binding.h" 19 #include "mojo/public/cpp/bindings/strong_binding.h"
19 #include "services/service_manager/public/cpp/connector.h" 20 #include "services/service_manager/public/cpp/connector.h"
20 21
21 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
22 #include "chrome/gpu/gpu_arc_video_service.h" 23 #include "chrome/gpu/gpu_arc_video_service.h"
23 #include "services/service_manager/public/cpp/interface_registry.h" 24 #include "content/public/common/service_manager_connection.h"
25 #include "content/public/common/simple_connection_filter.h"
26 #include "services/service_manager/public/cpp/binder_registry.h"
24 #endif 27 #endif
25 28
26 namespace { 29 namespace {
27 30
28 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
29 void CreateGpuArcVideoService( 32 void CreateGpuArcVideoService(
30 const gpu::GpuPreferences& gpu_preferences, 33 const gpu::GpuPreferences& gpu_preferences,
31 ::arc::mojom::VideoAcceleratorServiceRequest request) { 34 ::arc::mojom::VideoAcceleratorServiceRequest request) {
32 mojo::MakeStrongBinding( 35 mojo::MakeStrongBinding(
33 base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences), 36 base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences),
(...skipping 29 matching lines...) Expand all
63 *base::CommandLine::ForCurrentProcess(); 66 *base::CommandLine::ForCurrentProcess();
64 // No need for field trial syncer if we're in the browser process. 67 // No need for field trial syncer if we're in the browser process.
65 if (!command_line.HasSwitch(switches::kInProcessGPU)) { 68 if (!command_line.HasSwitch(switches::kInProcessGPU)) {
66 field_trial_syncer_.reset( 69 field_trial_syncer_.reset(
67 new variations::ChildProcessFieldTrialSyncer(observer)); 70 new variations::ChildProcessFieldTrialSyncer(observer));
68 field_trial_syncer_->InitFieldTrialObserving(command_line, 71 field_trial_syncer_->InitFieldTrialObserving(command_line,
69 switches::kSingleProcess); 72 switches::kSingleProcess);
70 } 73 }
71 } 74 }
72 75
73 void ChromeContentGpuClient::ExposeInterfacesToBrowser( 76 void ChromeContentGpuClient::GpuServiceInitialized(
74 service_manager::InterfaceRegistry* registry,
75 const gpu::GpuPreferences& gpu_preferences) { 77 const gpu::GpuPreferences& gpu_preferences) {
76 #if defined(OS_CHROMEOS) 78 #if defined(OS_CHROMEOS)
77 registry->AddInterface( 79 auto registry = base::MakeUnique<service_manager::BinderRegistry>();
78 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); 80 registry->AddInterface(base::Bind(&CreateGpuArcVideoService, gpu_preferences),
81 base::ThreadTaskRunnerHandle::Get());
82 content::ChildThread::Get()
83 ->GetServiceManagerConnection()
84 ->AddConnectionFilter(base::MakeUnique<content::SimpleConnectionFilter>(
85 std::move(registry)));
79 #endif 86 #endif
80 }
81 87
82 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser(
83 service_manager::Connector* connector) {
84 metrics::mojom::CallStackProfileCollectorPtr browser_interface; 88 metrics::mojom::CallStackProfileCollectorPtr browser_interface;
85 connector->BindInterface(content::mojom::kBrowserServiceName, 89 content::ChildThread::Get()->GetConnector()->BindInterface(
86 &browser_interface); 90 content::mojom::kBrowserServiceName, &browser_interface);
87 g_call_stack_profile_collector.Get().SetParentProfileCollector( 91 g_call_stack_profile_collector.Get().SetParentProfileCollector(
88 std::move(browser_interface)); 92 std::move(browser_interface));
89 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698