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 #include "mojo/public/cpp/bindings/lib/router.h" | 5 #include "mojo/public/cpp/bindings/lib/router.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 control_message_proxy_.OnConnectionError(); | 322 control_message_proxy_.OnConnectionError(); |
323 | 323 |
324 encountered_error_ = true; | 324 encountered_error_ = true; |
325 | 325 |
326 // The callbacks may hold on to resources. There is no need to keep them any | 326 // The callbacks may hold on to resources. There is no need to keep them any |
327 // longer. | 327 // longer. |
328 async_responders_.clear(); | 328 async_responders_.clear(); |
329 | 329 |
330 if (!error_handler_.is_null()) | 330 if (!error_handler_.is_null()) { |
331 error_handler_.Run(); | 331 error_handler_.Run(); |
| 332 } else if (!error_with_reason_handler_.is_null()) { |
| 333 // Make a copy on the stack. If we directly pass a reference to a member of |
| 334 // |control_message_handler_|, that reference will be invalidated as soon as |
| 335 // the user destroys the interface endpoint. |
| 336 std::string description = control_message_handler_.disconnect_description(); |
| 337 error_with_reason_handler_.Run( |
| 338 control_message_handler_.disconnect_custom_reason(), description); |
| 339 } |
332 } | 340 } |
333 | 341 |
334 // ---------------------------------------------------------------------------- | 342 // ---------------------------------------------------------------------------- |
335 | 343 |
336 } // namespace internal | 344 } // namespace internal |
337 } // namespace mojo | 345 } // namespace mojo |
OLD | NEW |