| Index: mojo/public/cpp/bindings/associated_interface_request.h
|
| diff --git a/mojo/public/cpp/bindings/associated_interface_request.h b/mojo/public/cpp/bindings/associated_interface_request.h
|
| index 30fcd16ec14496d30ae318aa240ed46cedb0b75a..361b301d38957d8eed565d4364d87e2e94920f01 100644
|
| --- a/mojo/public/cpp/bindings/associated_interface_request.h
|
| +++ b/mojo/public/cpp/bindings/associated_interface_request.h
|
| @@ -5,9 +5,15 @@
|
| #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
|
| #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
|
|
|
| +#include <string>
|
| #include <utility>
|
|
|
| #include "base/macros.h"
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/threading/thread_task_runner_handle.h"
|
| +#include "mojo/public/cpp/bindings/interface_endpoint_client.h"
|
| +#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
|
| +#include "mojo/public/cpp/bindings/message.h"
|
| #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
|
|
|
| namespace mojo {
|
| @@ -64,6 +70,28 @@ class AssociatedInterfaceRequest {
|
| return !is_pending() && !other.is_pending();
|
| }
|
|
|
| + void ResetWithReason(uint32_t custom_reason, const std::string& description) {
|
| + if (!handle_.is_valid())
|
| + return;
|
| +
|
| + if (!handle_.is_local()) {
|
| + // This handle is supposed to be sent to the other end of the message
|
| + // pipe and used there.
|
| + NOTREACHED();
|
| + handle_.reset();
|
| + return;
|
| + }
|
| +
|
| + InterfaceEndpointClient client(std::move(handle_), nullptr,
|
| + base::MakeUnique<PassThroughFilter>(), false,
|
| + base::ThreadTaskRunnerHandle::Get(), 0u);
|
| + Message message =
|
| + internal::ControlMessageProxy::ConstructDisconnectReasonMessage(
|
| + custom_reason, description);
|
| + bool result = client.Accept(&message);
|
| + DCHECK(result);
|
| + }
|
| +
|
| private:
|
| ScopedInterfaceEndpointHandle handle_;
|
|
|
|
|