| 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> |  | 
| 10 |  | 
| 11 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 12 #include "base/location.h" | 10 #include "base/location.h" | 
| 13 #include "base/logging.h" | 11 #include "base/logging.h" | 
| 14 #include "base/macros.h" | 12 #include "base/macros.h" | 
| 15 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" | 
| 16 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" | 
| 17 #include "base/stl_util.h" | 15 #include "base/stl_util.h" | 
| 18 #include "mojo/public/cpp/bindings/associated_group.h" | 16 #include "mojo/public/cpp/bindings/associated_group.h" | 
| 19 #include "mojo/public/cpp/bindings/associated_group_controller.h" | 17 #include "mojo/public/cpp/bindings/associated_group_controller.h" | 
| 20 #include "mojo/public/cpp/bindings/interface_endpoint_controller.h" | 18 #include "mojo/public/cpp/bindings/interface_endpoint_controller.h" | 
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 302   encountered_error_ = true; | 300   encountered_error_ = true; | 
| 303 | 301 | 
| 304   // Response callbacks may hold on to resource, and there's no need to keep | 302   // Response callbacks may hold on to resource, and there's no need to keep | 
| 305   // them alive any longer. Note that it's allowed that a pending response | 303   // them alive any longer. Note that it's allowed that a pending response | 
| 306   // callback may own this endpoint, so we simply move the responders onto the | 304   // callback may own this endpoint, so we simply move the responders onto the | 
| 307   // stack here and let them be destroyed when the stack unwinds. | 305   // stack here and let them be destroyed when the stack unwinds. | 
| 308   AsyncResponderMap responders = std::move(async_responders_); | 306   AsyncResponderMap responders = std::move(async_responders_); | 
| 309 | 307 | 
| 310   control_message_proxy_.OnConnectionError(); | 308   control_message_proxy_.OnConnectionError(); | 
| 311 | 309 | 
| 312   if (!error_handler_.is_null()) { | 310   if (error_handler_) { | 
| 313     base::Closure error_handler = std::move(error_handler_); | 311     std::move(error_handler_).Run(); | 
| 314     error_handler.Run(); | 312   } else if (error_with_reason_handler_) { | 
| 315   } else if (!error_with_reason_handler_.is_null()) { |  | 
| 316     ConnectionErrorWithReasonCallback error_with_reason_handler = |  | 
| 317         std::move(error_with_reason_handler_); |  | 
| 318     if (reason) { | 313     if (reason) { | 
| 319       error_with_reason_handler.Run(reason->custom_reason, reason->description); | 314       std::move(error_with_reason_handler_) | 
|  | 315           .Run(reason->custom_reason, reason->description); | 
| 320     } else { | 316     } else { | 
| 321       error_with_reason_handler.Run(0, std::string()); | 317       std::move(error_with_reason_handler_).Run(0, std::string()); | 
| 322     } | 318     } | 
| 323   } | 319   } | 
| 324 } | 320 } | 
| 325 | 321 | 
| 326 void InterfaceEndpointClient::QueryVersion( | 322 void InterfaceEndpointClient::QueryVersion( | 
| 327     const base::Callback<void(uint32_t)>& callback) { | 323     const base::Callback<void(uint32_t)>& callback) { | 
| 328   control_message_proxy_.QueryVersion(callback); | 324   control_message_proxy_.QueryVersion(callback); | 
| 329 } | 325 } | 
| 330 | 326 | 
| 331 void InterfaceEndpointClient::RequireVersion(uint32_t version) { | 327 void InterfaceEndpointClient::RequireVersion(uint32_t version) { | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 403     return responder->Accept(message); | 399     return responder->Accept(message); | 
| 404   } else { | 400   } else { | 
| 405     if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) | 401     if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) | 
| 406       return control_message_handler_.Accept(message); | 402       return control_message_handler_.Accept(message); | 
| 407 | 403 | 
| 408     return incoming_receiver_->Accept(message); | 404     return incoming_receiver_->Accept(message); | 
| 409   } | 405   } | 
| 410 } | 406 } | 
| 411 | 407 | 
| 412 }  // namespace mojo | 408 }  // namespace mojo | 
| OLD | NEW | 
|---|