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

Unified Diff: components/nacl/common/nacl_service.cc

Issue 2795883002: Eliminate OnConnect usage (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: components/nacl/common/nacl_service.cc
diff --git a/components/nacl/common/nacl_service.cc b/components/nacl/common/nacl_service.cc
index fb19f6a814edaf9533e86af32848bbce5383a620..eecc1392eae7c41a9b64723af4c89dcb04e85f97 100644
--- a/components/nacl/common/nacl_service.cc
+++ b/components/nacl/common/nacl_service.cc
@@ -14,7 +14,7 @@
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/service_manager/public/cpp/service_info.h"
@@ -65,35 +65,38 @@ class NaClService : public service_manager::Service {
~NaClService() override;
// Service overrides.
- bool OnConnect(const service_manager::ServiceInfo& remote_info,
- service_manager::InterfaceRegistry* registry) override;
+ void OnBindInterface(const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) override;
private:
IPC::mojom::ChannelBootstrapPtrInfo ipc_channel_bootstrap_;
std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_;
bool connected_ = false;
+ service_manager::BinderRegistry registry_;
};
NaClService::NaClService(
IPC::mojom::ChannelBootstrapPtrInfo bootstrap,
std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support)
: ipc_channel_bootstrap_(std::move(bootstrap)),
- ipc_support_(std::move(ipc_support)) {}
+ ipc_support_(std::move(ipc_support)) {
+ registry_.AddInterface(base::Bind(&ConnectBootstrapChannel,
+ base::Passed(&ipc_channel_bootstrap_)));
+}
NaClService::~NaClService() = default;
-bool NaClService::OnConnect(const service_manager::ServiceInfo& remote_info,
- service_manager::InterfaceRegistry* registry) {
- if (remote_info.identity.name() != content::mojom::kBrowserServiceName)
- return false;
-
- if (connected_)
- return false;
-
- connected_ = true;
- registry->AddInterface(base::Bind(&ConnectBootstrapChannel,
- base::Passed(&ipc_channel_bootstrap_)));
- return true;
+void NaClService::OnBindInterface(
+ const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ if (source_info.identity.name() == content::mojom::kBrowserServiceName &&
+ !connected_) {
+ connected_ = true;
+ registry_.BindInterface(source_info.identity, interface_name,
+ std::move(interface_pipe));
+ }
}
} // namespace
« no previous file with comments | « components/leveldb/leveldb_app.cc ('k') | content/browser/dom_storage/local_storage_context_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698