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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/gpu/chrome_content_gpu_client.cc
diff --git a/chrome/gpu/chrome_content_gpu_client.cc b/chrome/gpu/chrome_content_gpu_client.cc
index 516080a7591ec4c5ac01b95c91a2b1a1ae1c0e8e..80ec9ca0cb7a007a4169dc1f079990d681fcf7b3 100644
--- a/chrome/gpu/chrome_content_gpu_client.cc
+++ b/chrome/gpu/chrome_content_gpu_client.cc
@@ -13,6 +13,7 @@
#include "base/time/time.h"
#include "chrome/common/stack_sampling_configuration.h"
#include "components/metrics/child_call_stack_profile_collector.h"
+#include "content/public/child/child_thread.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
@@ -20,21 +21,12 @@
#if defined(OS_CHROMEOS)
#include "chrome/gpu/gpu_arc_video_service.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
+#include "content/public/common/service_manager_connection.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
#endif
namespace {
-#if defined(OS_CHROMEOS)
-void CreateGpuArcVideoService(
- const gpu::GpuPreferences& gpu_preferences,
- ::arc::mojom::VideoAcceleratorServiceRequest request) {
- mojo::MakeStrongBinding(
- base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences),
- std::move(request));
-}
-#endif
-
base::LazyInstance<metrics::ChildCallStackProfileCollector>::Leaky
g_call_stack_profile_collector = LAZY_INSTANCE_INITIALIZER;
@@ -42,14 +34,15 @@ base::LazyInstance<metrics::ChildCallStackProfileCollector>::Leaky
ChromeContentGpuClient::ChromeContentGpuClient()
: stack_sampling_profiler_(
- base::PlatformThread::CurrentId(),
- StackSamplingConfiguration::Get()->GetSamplingParamsForCurrentProcess(),
- g_call_stack_profile_collector.Get().GetProfilerCallback(
- metrics::CallStackProfileParams(
- metrics::CallStackProfileParams::GPU_PROCESS,
- metrics::CallStackProfileParams::GPU_MAIN_THREAD,
- metrics::CallStackProfileParams::PROCESS_STARTUP,
- metrics::CallStackProfileParams::MAY_SHUFFLE))) {
+ base::PlatformThread::CurrentId(),
+ StackSamplingConfiguration::Get()
+ ->GetSamplingParamsForCurrentProcess(),
+ g_call_stack_profile_collector.Get().GetProfilerCallback(
+ metrics::CallStackProfileParams(
+ metrics::CallStackProfileParams::GPU_PROCESS,
+ metrics::CallStackProfileParams::GPU_MAIN_THREAD,
+ metrics::CallStackProfileParams::PROCESS_STARTUP,
+ metrics::CallStackProfileParams::MAY_SHUFFLE))) {
if (StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess())
stack_sampling_profiler_.Start();
}
@@ -57,7 +50,8 @@ ChromeContentGpuClient::ChromeContentGpuClient()
ChromeContentGpuClient::~ChromeContentGpuClient() {}
void ChromeContentGpuClient::Initialize(
- base::FieldTrialList::Observer* observer) {
+ base::FieldTrialList::Observer* observer,
+ service_manager::BinderRegistry* registry) {
DCHECK(!field_trial_syncer_);
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -68,22 +62,35 @@ void ChromeContentGpuClient::Initialize(
field_trial_syncer_->InitFieldTrialObserving(command_line,
switches::kSingleProcess);
}
-}
-void ChromeContentGpuClient::ExposeInterfacesToBrowser(
- service_manager::InterfaceRegistry* registry,
- const gpu::GpuPreferences& gpu_preferences) {
#if defined(OS_CHROMEOS)
registry->AddInterface(
- base::Bind(&CreateGpuArcVideoService, gpu_preferences));
+ base::Bind(&ChromeContentGpuClient::CreateArcVideoAcceleratorService,
+ base::Unretained(this)),
+ base::ThreadTaskRunnerHandle::Get());
#endif
}
-void ChromeContentGpuClient::ConsumeInterfacesFromBrowser(
- service_manager::Connector* connector) {
+void ChromeContentGpuClient::GpuServiceInitialized(
+ const gpu::GpuPreferences& gpu_preferences) {
+#if defined(OS_CHROMEOS)
+ gpu_preferences_ = gpu_preferences;
+#endif
+
metrics::mojom::CallStackProfileCollectorPtr browser_interface;
- connector->BindInterface(content::mojom::kBrowserServiceName,
- &browser_interface);
+ content::ChildThread::Get()->GetConnector()->BindInterface(
+ content::mojom::kBrowserServiceName, &browser_interface);
g_call_stack_profile_collector.Get().SetParentProfileCollector(
std::move(browser_interface));
}
+
+#if defined(OS_CHROMEOS)
+
+void ChromeContentGpuClient::CreateArcVideoAcceleratorService(
+ ::arc::mojom::VideoAcceleratorServiceRequest request) {
+ mojo::MakeStrongBinding(
+ base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences_),
+ std::move(request));
+}
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698