| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" | 5 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 // Response callbacks may hold on to resource, and there's no need to keep | 306 // Response callbacks may hold on to resource, and there's no need to keep |
| 307 // them alive any longer. Note that it's allowed that a pending response | 307 // them alive any longer. Note that it's allowed that a pending response |
| 308 // callback may own this endpoint, so we simply move the responders onto the | 308 // callback may own this endpoint, so we simply move the responders onto the |
| 309 // stack here and let them be destroyed when the stack unwinds. | 309 // stack here and let them be destroyed when the stack unwinds. |
| 310 AsyncResponderMap responders = std::move(async_responders_); | 310 AsyncResponderMap responders = std::move(async_responders_); |
| 311 | 311 |
| 312 control_message_proxy_.OnConnectionError(); | 312 control_message_proxy_.OnConnectionError(); |
| 313 | 313 |
| 314 if (!error_handler_.is_null()) { | 314 if (!error_handler_.is_null()) { |
| 315 error_handler_.Run(); | 315 base::Closure error_handler = std::move(error_handler_); |
| 316 error_handler.Run(); |
| 316 } else if (!error_with_reason_handler_.is_null()) { | 317 } else if (!error_with_reason_handler_.is_null()) { |
| 318 ConnectionErrorWithReasonCallback error_with_reason_handler = |
| 319 std::move(error_with_reason_handler_); |
| 317 if (reason) { | 320 if (reason) { |
| 318 error_with_reason_handler_.Run(reason->custom_reason, | 321 error_with_reason_handler.Run(reason->custom_reason, reason->description); |
| 319 reason->description); | |
| 320 } else { | 322 } else { |
| 321 error_with_reason_handler_.Run(0, std::string()); | 323 error_with_reason_handler.Run(0, std::string()); |
| 322 } | 324 } |
| 323 } | 325 } |
| 324 } | 326 } |
| 325 | 327 |
| 326 void InterfaceEndpointClient::QueryVersion( | 328 void InterfaceEndpointClient::QueryVersion( |
| 327 const base::Callback<void(uint32_t)>& callback) { | 329 const base::Callback<void(uint32_t)>& callback) { |
| 328 control_message_proxy_.QueryVersion(callback); | 330 control_message_proxy_.QueryVersion(callback); |
| 329 } | 331 } |
| 330 | 332 |
| 331 void InterfaceEndpointClient::RequireVersion(uint32_t version) { | 333 void InterfaceEndpointClient::RequireVersion(uint32_t version) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 return responder->Accept(message); | 406 return responder->Accept(message); |
| 405 } else { | 407 } else { |
| 406 if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) | 408 if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
| 407 return control_message_handler_.Accept(message); | 409 return control_message_handler_.Accept(message); |
| 408 | 410 |
| 409 return incoming_receiver_->Accept(message); | 411 return incoming_receiver_->Accept(message); |
| 410 } | 412 } |
| 411 } | 413 } |
| 412 | 414 |
| 413 } // namespace mojo | 415 } // namespace mojo |
| OLD | NEW |