Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: mojo/public/cpp/bindings/lib/router.cc

Issue 2318793002: Mojo C++ bindings: support disconnect with a reason. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/strong_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698