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/common/content_switches.h" |
16 #include "mojo/public/cpp/bindings/strong_binding.h" | 17 #include "mojo/public/cpp/bindings/strong_binding.h" |
17 #include "services/service_manager/public/cpp/connector.h" | 18 #include "services/service_manager/public/cpp/connector.h" |
18 #include "services/service_manager/public/cpp/interface_registry.h" | 19 #include "services/service_manager/public/cpp/interface_registry.h" |
19 | 20 |
20 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
21 #include "chrome/gpu/gpu_arc_video_service.h" | 22 #include "chrome/gpu/gpu_arc_video_service.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 metrics::CallStackProfileParams::MAY_SHUFFLE))) { | 59 metrics::CallStackProfileParams::MAY_SHUFFLE))) { |
59 if (StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) | 60 if (StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) |
60 stack_sampling_profiler_.Start(); | 61 stack_sampling_profiler_.Start(); |
61 } | 62 } |
62 | 63 |
63 ChromeContentGpuClient::~ChromeContentGpuClient() {} | 64 ChromeContentGpuClient::~ChromeContentGpuClient() {} |
64 | 65 |
65 void ChromeContentGpuClient::Initialize( | 66 void ChromeContentGpuClient::Initialize( |
66 base::FieldTrialList::Observer* observer) { | 67 base::FieldTrialList::Observer* observer) { |
67 DCHECK(!field_trial_syncer_); | 68 DCHECK(!field_trial_syncer_); |
68 field_trial_syncer_.reset( | |
69 new chrome_variations::ChildProcessFieldTrialSyncer(observer)); | |
70 const base::CommandLine& command_line = | 69 const base::CommandLine& command_line = |
71 *base::CommandLine::ForCurrentProcess(); | 70 *base::CommandLine::ForCurrentProcess(); |
72 field_trial_syncer_->InitFieldTrialObserving(command_line); | 71 // No need for field trial syncer if we're in the browser process. |
| 72 if (!command_line.HasSwitch(switches::kInProcessGPU)) { |
| 73 field_trial_syncer_.reset( |
| 74 new chrome_variations::ChildProcessFieldTrialSyncer(observer)); |
| 75 field_trial_syncer_->InitFieldTrialObserving(command_line); |
| 76 } |
73 } | 77 } |
74 | 78 |
75 void ChromeContentGpuClient::ExposeInterfacesToBrowser( | 79 void ChromeContentGpuClient::ExposeInterfacesToBrowser( |
76 service_manager::InterfaceRegistry* registry, | 80 service_manager::InterfaceRegistry* registry, |
77 const gpu::GpuPreferences& gpu_preferences) { | 81 const gpu::GpuPreferences& gpu_preferences) { |
78 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
79 registry->AddInterface( | 83 registry->AddInterface( |
80 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); | 84 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); |
81 registry->AddInterface( | 85 registry->AddInterface( |
82 base::Bind(&DeprecatedCreateGpuArcVideoService, gpu_preferences)); | 86 base::Bind(&DeprecatedCreateGpuArcVideoService, gpu_preferences)); |
83 #endif | 87 #endif |
84 } | 88 } |
85 | 89 |
86 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser( | 90 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser( |
87 service_manager::InterfaceProvider* provider) { | 91 service_manager::InterfaceProvider* provider) { |
88 metrics::mojom::CallStackProfileCollectorPtr browser_interface; | 92 metrics::mojom::CallStackProfileCollectorPtr browser_interface; |
89 provider->GetInterface(&browser_interface); | 93 provider->GetInterface(&browser_interface); |
90 g_call_stack_profile_collector.Get().SetParentProfileCollector( | 94 g_call_stack_profile_collector.Get().SetParentProfileCollector( |
91 std::move(browser_interface)); | 95 std::move(browser_interface)); |
92 } | 96 } |
OLD | NEW |