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

Side by Side Diff: mojo/public/cpp/bindings/associated_binding.h

Issue 1475813002: Mojo C++ bindings: support passing associated interface pointers/requests in method parameter lists… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_use_multiplex_router
Patch Set: Created 5 years 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 | « no previous file | mojo/public/cpp/bindings/lib/array_serialization.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 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/public/cpp/bindings/associated_group.h" 10 #include "mojo/public/cpp/bindings/associated_group.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 << "other side of the message pipe."; 72 << "other side of the message pipe.";
73 73
74 if (!handle.is_valid() || !handle.is_local()) { 74 if (!handle.is_valid() || !handle.is_local()) {
75 endpoint_client_.reset(); 75 endpoint_client_.reset();
76 return; 76 return;
77 } 77 }
78 78
79 endpoint_client_.reset(new internal::InterfaceEndpointClient( 79 endpoint_client_.reset(new internal::InterfaceEndpointClient(
80 handle.Pass(), &stub_, 80 handle.Pass(), &stub_,
81 make_scoped_ptr(new typename Interface::RequestValidator_()))); 81 make_scoped_ptr(new typename Interface::RequestValidator_())));
82
83 endpoint_client_->set_connection_error_handler( 82 endpoint_client_->set_connection_error_handler(
84 [this]() { connection_error_handler_.Run(); }); 83 [this]() { connection_error_handler_.Run(); });
84
85 stub_.serialization_context()->router = endpoint_client_->router();
85 } 86 }
86 87
87 // Closes the associated interface. Puts this object into a state where it can 88 // Closes the associated interface. Puts this object into a state where it can
88 // be rebound. 89 // be rebound.
89 void Close() { 90 void Close() {
90 DCHECK(endpoint_client_); 91 DCHECK(endpoint_client_);
91 endpoint_client_.reset(); 92 endpoint_client_.reset();
92 } 93 }
93 94
94 // Unbinds and returns the associated interface request so it can be 95 // Unbinds and returns the associated interface request so it can be
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 typename Interface::Stub_ stub_; 130 typename Interface::Stub_ stub_;
130 Interface* impl_; 131 Interface* impl_;
131 Closure connection_error_handler_; 132 Closure connection_error_handler_;
132 133
133 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); 134 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding);
134 }; 135 };
135 136
136 } // namespace mojo 137 } // namespace mojo
137 138
138 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 139 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698