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

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

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed) Base URL: git@github.com:domokit/mojo.git@app_impl_init
Patch Set: fix android Created 5 years, 11 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
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
7 7
8 #include "mojo/public/c/environment/async_waiter.h" 8 #include "mojo/public/c/environment/async_waiter.h"
9 #include "mojo/public/cpp/bindings/error_handler.h" 9 #include "mojo/public/cpp/bindings/error_handler.h"
10 #include "mojo/public/cpp/bindings/interface_ptr.h" 10 #include "mojo/public/cpp/bindings/interface_ptr.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 MOJO_DCHECK(internal_router_); 158 MOJO_DCHECK(internal_router_);
159 return internal_router_->WaitForIncomingMessage(); 159 return internal_router_->WaitForIncomingMessage();
160 } 160 }
161 161
162 // Closes the message pipe that was previously bound. 162 // Closes the message pipe that was previously bound.
163 void Close() { 163 void Close() {
164 MOJO_DCHECK(internal_router_); 164 MOJO_DCHECK(internal_router_);
165 internal_router_->CloseMessagePipe(); 165 internal_router_->CloseMessagePipe();
166 } 166 }
167 167
168 // Unbinds the underlying pipe from this binding and returns it so it can be
169 // used in another context, such as on another thread or with a different
170 // implementation.
171 InterfaceRequest<Interface> Unbind() {
172 return MakeRequest<Interface>(internal_router_->PassMessagePipe());
173 }
174
168 // Sets an error handler that will be called if a connection error occurs on 175 // Sets an error handler that will be called if a connection error occurs on
169 // the bound message pipe. 176 // the bound message pipe.
170 void set_error_handler(ErrorHandler* error_handler) { 177 void set_error_handler(ErrorHandler* error_handler) {
171 error_handler_ = error_handler; 178 error_handler_ = error_handler;
172 } 179 }
173 180
174 // Implements the |Binding|'s response to a connection error. 181 // Implements the |Binding|'s response to a connection error.
175 void OnConnectionError() override { 182 void OnConnectionError() override {
176 if (error_handler_) 183 if (error_handler_)
177 error_handler_->OnConnectionError(); 184 error_handler_->OnConnectionError();
(...skipping 19 matching lines...) Expand all
197 typename Interface::Stub_ stub_; 204 typename Interface::Stub_ stub_;
198 Interface* impl_; 205 Interface* impl_;
199 ErrorHandler* error_handler_ = nullptr; 206 ErrorHandler* error_handler_ = nullptr;
200 207
201 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); 208 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding);
202 }; 209 };
203 210
204 } // namespace mojo 211 } // namespace mojo
205 212
206 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ 213 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698