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

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..c942df706cb005be6cfcc2ba9a4ccb02ce91877f 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,19 +21,36 @@
#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 "content/public/common/simple_connection_filter.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));
+
+class GpuArcVideoServiceFactory {
+ public:
+ GpuArcVideoServiceFactory() {}
+ ~GpuArcVideoServiceFactory() {}
+
+ void Create(::arc::mojom::VideoAcceleratorServiceRequest request) {
+ mojo::MakeStrongBinding(
+ base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences_),
+ std::move(request));
+ }
+
+ void set_gpu_preferences(const gpu::GpuPreferences& gpu_preferences) {
+ gpu_preferences_ = gpu_preferences;
+ }
+
+ private:
+ gpu::GpuPreferences gpu_preferences_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuArcVideoServiceFactory);
}
+
#endif
base::LazyInstance<metrics::ChildCallStackProfileCollector>::Leaky
@@ -57,7 +75,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 +87,26 @@ 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)
+ gpu_arc_video_service_factory_ =
+ base::MakeUnique<GpuArcVideoServiceFactory>();
registry->AddInterface(
- base::Bind(&CreateGpuArcVideoService, gpu_preferences));
+ base::Bind(&GpuArcVideoServiceFactory::Create,
+ base::Unretained(gpu_arc_video_service_factory_)),
+ base::ThreadTaskRunnerHandle::Get());
#endif
}
-void ChromeContentGpuClient::ConsumeInterfacesFromBrowser(
- service_manager::Connector* connector) {
+void ChromeContentGpuClient::GpuServiceInitialized(
+ const gpu::GpuPreferences& gpu_preferences) {
+#if defined(OS_CHROMEOS)
+ gpu_arc_video_service_factory_->set_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));
}

Powered by Google App Engine
This is Rietveld 408576698