Move GPU interfaces off of Service Manager
This changes the GPU process to expose browser-facing interfaces through
the Content ChildProcess interface.
ChildThreadImpl now allows subclasses to provide a BinderMap to handle
incoming interface binding requests from the browser. This is a fairly
simple drop-in replacement for what used to be done through
the Service Manager with a ConnectionFilter.
There should be no behavioral changes here. In particular for
GPU interfaces, this CL is careful to preserve the behavior which avoids
binding incoming interface receivers until |OnGpuServiceConnection()| is
invoked.
Bug: 977637
Change-Id: Id00a1f0b1178f9c3fed2816eea9808f162829798
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1905050
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Zhenyao Mo <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Robert Kroeger <[email protected]>
Commit-Queue: Ken Rockot <[email protected]>
Cr-Commit-Position: refs/heads/master@{#714969}
diff --git a/content/gpu/browser_exposed_gpu_interfaces.cc b/content/gpu/browser_exposed_gpu_interfaces.cc
new file mode 100644
index 0000000..c84d1fe
--- /dev/null
+++ b/content/gpu/browser_exposed_gpu_interfaces.cc
@@ -0,0 +1,29 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/gpu/browser_exposed_gpu_interfaces.h"
+
+#include "content/public/common/content_client.h"
+#include "content/public/gpu/content_gpu_client.h"
+#include "mojo/public/cpp/bindings/binder_map.h"
+
+#if defined(USE_OZONE)
+#include "ui/ozone/public/ozone_platform.h"
+#endif
+
+namespace content {
+
+void ExposeGpuInterfacesToBrowser(const gpu::GpuPreferences& gpu_preferences,
+ mojo::BinderMap* binders) {
+ if (GetContentClient()->gpu()) { // May be null in tests.
+ GetContentClient()->gpu()->ExposeInterfacesToBrowser(gpu_preferences,
+ binders);
+ }
+
+#if defined(USE_OZONE)
+ ui::OzonePlatform::GetInstance()->AddInterfaces(binders);
+#endif
+}
+
+} // namespace content