| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // Now that the two refer to different objects, they are equivalent if | 80 // Now that the two refer to different objects, they are equivalent if |
| 81 // and only if they are both invalid. | 81 // and only if they are both invalid. |
| 82 return !is_pending() && !other.is_pending(); | 82 return !is_pending() && !other.is_pending(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ResetWithReason(uint32_t custom_reason, const std::string& description) { | 85 void ResetWithReason(uint32_t custom_reason, const std::string& description) { |
| 86 if (!handle_.is_valid()) | 86 if (!handle_.is_valid()) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 base::Optional<DisconnectReason> reason; | |
| 90 reason.emplace(custom_reason, description); | |
| 91 | |
| 92 Message message = | 89 Message message = |
| 93 PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( | 90 PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( |
| 94 kMasterInterfaceId, reason); | 91 kMasterInterfaceId, DisconnectReason(custom_reason, description)); |
| 95 MojoResult result = WriteMessageNew( | 92 MojoResult result = WriteMessageNew( |
| 96 handle_.get(), message.TakeMojoMessage(), MOJO_WRITE_MESSAGE_FLAG_NONE); | 93 handle_.get(), message.TakeMojoMessage(), MOJO_WRITE_MESSAGE_FLAG_NONE); |
| 97 DCHECK_EQ(MOJO_RESULT_OK, result); | 94 DCHECK_EQ(MOJO_RESULT_OK, result); |
| 98 | 95 |
| 99 handle_.reset(); | 96 handle_.reset(); |
| 100 } | 97 } |
| 101 | 98 |
| 102 private: | 99 private: |
| 103 ScopedMessagePipeHandle handle_; | 100 ScopedMessagePipeHandle handle_; |
| 104 | 101 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 bool FuseInterface(InterfaceRequest<Interface> request, | 169 bool FuseInterface(InterfaceRequest<Interface> request, |
| 173 InterfacePtrInfo<Interface> proxy_info) { | 170 InterfacePtrInfo<Interface> proxy_info) { |
| 174 MojoResult result = FuseMessagePipes(request.PassMessagePipe(), | 171 MojoResult result = FuseMessagePipes(request.PassMessagePipe(), |
| 175 proxy_info.PassHandle()); | 172 proxy_info.PassHandle()); |
| 176 return result == MOJO_RESULT_OK; | 173 return result == MOJO_RESULT_OK; |
| 177 } | 174 } |
| 178 | 175 |
| 179 } // namespace mojo | 176 } // namespace mojo |
| 180 | 177 |
| 181 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 178 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| OLD | NEW |