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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 2766263009: Convert content ConnectionFilter to OnBindInterface (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
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 643b6418edf464f6be312817f337762799bd05e7..fe3c79019bc548e9f51a365f078b8b741ee915f0 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -67,9 +67,9 @@
#include "media/media_features.h"
#include "mojo/edk/embedder/embedder.h"
#include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/interface_provider.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
#include "services/service_manager/runner/common/client_util.h"
#include "ui/display/display_switches.h"
#include "ui/events/latency_info.h"
@@ -335,35 +335,35 @@ void HostLoadedShader(int host_id,
class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
public:
- ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {}
-
- private:
- // ConnectionFilter:
- bool OnConnect(const service_manager::Identity& remote_identity,
- service_manager::InterfaceRegistry* registry,
- service_manager::Connector* connector) override {
- if (remote_identity.name() != mojom::kGpuServiceName)
- return false;
-
- registry->AddInterface(
+ ConnectionFilterImpl() {
+ registry_.AddInterface(
base::Bind(
&memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest,
base::Unretained(
memory_instrumentation::CoordinatorImpl::GetInstance())),
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI));
-
- GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry,
- host_);
-
#if defined(OS_ANDROID)
- GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(registry);
+ GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(&registry_);
#endif
+ }
- return true;
+ private:
+ // ConnectionFilter:
+ void OnBindInterface(const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle* interface_pipe,
+ service_manager::Connector* connector) override {
+ if (registry_.CanBindInterface(interface_name)) {
+ registry_.BindInterface(source_info.identity, interface_name,
+ std::move(*interface_pipe));
+ } else {
+ GetContentClient()->browser()->BindInterfaceRequest(
+ source_info, interface_name, interface_pipe);
+ }
}
- GpuProcessHost* host_;
+ service_manager::BinderRegistry registry_;
DISALLOW_COPY_AND_ASSIGN(ConnectionFilterImpl);
};
@@ -469,8 +469,11 @@ void GpuProcessHost::CallOnIO(
base::Bind(&RunCallbackOnIO, kind, force_create, callback));
}
-service_manager::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
- return process_->child_connection()->GetRemoteInterfaces();
+void GpuProcessHost::BindInterface(
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ process_->child_connection()->BindInterface(interface_name,
+ std::move(interface_pipe));
}
// static
@@ -621,7 +624,7 @@ bool GpuProcessHost::Init() {
// May be null during test execution.
if (ServiceManagerConnection::GetForProcess()) {
ServiceManagerConnection::GetForProcess()->AddConnectionFilter(
- base::MakeUnique<ConnectionFilterImpl>(this));
+ base::MakeUnique<ConnectionFilterImpl>());
}
process_->GetHost()->CreateChannelMojo();
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698