Commit 4015f271 authored by leon.han's avatar leon.han Committed by Commit bot

Simplify content::AssociatedInterfaceProviderImpl

This CL uses mojo::MakeRequestForTesting() to internally create the message pipe
on which mojom::AssociatedInterfaceProvider will be associated.

BUG=

Review-Url: https://codereview.chromium.org/2603743002
Cr-Commit-Position: refs/heads/master@{#440829}
parent af12323b
......@@ -4,20 +4,16 @@
#include "content/common/associated_interface_provider_impl.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace content {
class AssociatedInterfaceProviderImpl::LocalProvider
: public mojom::RouteProvider,
mojom::AssociatedInterfaceProvider {
: public mojom::AssociatedInterfaceProvider {
public:
explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy)
: route_provider_binding_(this),
associated_interface_provider_binding_(this) {
route_provider_binding_.Bind(mojo::MakeRequest(&route_provider_ptr_));
route_provider_ptr_->GetRoute(
0, mojo::MakeRequest(proxy, route_provider_ptr_.associated_group()));
: associated_interface_provider_binding_(this) {
associated_interface_provider_binding_.Bind(
mojo::MakeRequestForTesting(proxy));
}
~LocalProvider() override {}
......@@ -29,14 +25,6 @@ class AssociatedInterfaceProviderImpl::LocalProvider
}
private:
// mojom::RouteProvider:
void GetRoute(
int32_t routing_id,
mojom::AssociatedInterfaceProviderAssociatedRequest request) override {
DCHECK(request.is_pending());
associated_interface_provider_binding_.Bind(std::move(request));
}
// mojom::AssociatedInterfaceProvider:
void GetAssociatedInterface(
const std::string& name,
......@@ -51,9 +39,6 @@ class AssociatedInterfaceProviderImpl::LocalProvider
base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>>;
BinderMap binders_;
mojom::RouteProviderPtr route_provider_ptr_;
mojo::Binding<mojom::RouteProvider> route_provider_binding_;
mojo::AssociatedBinding<mojom::AssociatedInterfaceProvider>
associated_interface_provider_binding_;
};
......
......@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_
#define CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_
#include "content/public/common/associated_interface_provider.h"
#include <stdint.h>
......@@ -43,3 +46,5 @@ class AssociatedInterfaceProviderImpl : public AssociatedInterfaceProvider {
};
} // namespace content
#endif // CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment