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

Unified Diff: content/child/child_thread_impl.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/child/child_thread_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index f91f11f74e38def29aed7e45a9dae7bb2297e870..856970a9c22e1a182ce106857f08528f58c49860 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -261,28 +261,26 @@ void InitializeMojoIPCChannel() {
class ChannelBootstrapFilter : public ConnectionFilter {
public:
explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap)
- : bootstrap_(std::move(bootstrap)), weak_factory_(this) {}
+ : bootstrap_(std::move(bootstrap)) {}
private:
// ConnectionFilter:
- bool OnConnect(const service_manager::Identity& remote_identity,
- service_manager::InterfaceRegistry* registry,
- service_manager::Connector* connector) override {
- if (remote_identity.name() != mojom::kBrowserServiceName)
- return false;
-
- registry->AddInterface(base::Bind(&ChannelBootstrapFilter::CreateBootstrap,
- weak_factory_.GetWeakPtr()));
- return true;
- }
-
- void CreateBootstrap(IPC::mojom::ChannelBootstrapRequest request) {
- DCHECK(bootstrap_.is_valid());
- mojo::FuseInterface(std::move(request), std::move(bootstrap_));
+ void OnBindInterface(const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle* interface_pipe,
+ service_manager::Connector* connector) override {
+ if (source_info.identity.name() != mojom::kBrowserServiceName)
+ return;
+
+ if (interface_name == IPC::mojom::ChannelBootstrap::Name_) {
+ DCHECK(bootstrap_.is_valid());
+ mojo::FuseInterface(mojo::MakeRequest<IPC::mojom::ChannelBootstrap>(
+ std::move(*interface_pipe)),
+ std::move(bootstrap_));
+ }
}
IPC::mojom::ChannelBootstrapPtrInfo bootstrap_;
- base::WeakPtrFactory<ChannelBootstrapFilter> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChannelBootstrapFilter);
};
@@ -451,15 +449,6 @@ void ChildThreadImpl::Init(const Options& options) {
mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)),
GetIOTaskRunner());
- // When connect_to_browser is true, we obtain interfaces from the browser
- // process by connecting to it, rather than from the incoming interface
- // provider. Exposed interfaces are subject to manifest capability spec.
- if (options.connect_to_browser) {
- browser_connection_ =
- service_manager_connection_->GetConnector()->Connect(
- mojom::kBrowserServiceName);
- }
-
// TODO(rockot): Remove this once all child-to-browser interface connections
// are made via a Connector rather than directly through an
// InterfaceProvider, and all exposed interfaces are exposed via a
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698