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

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

Issue 1006653002: Closes the pipe when a Binding is destroyed. This was always the intended (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 #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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 InterfaceRequest<Interface> request, 94 InterfaceRequest<Interface> request,
95 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) 95 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
96 : Binding(impl) { 96 : Binding(impl) {
97 Bind(request.PassMessagePipe(), waiter); 97 Bind(request.PassMessagePipe(), waiter);
98 } 98 }
99 99
100 // Tears down the binding, closing the message pipe and leaving the interface 100 // Tears down the binding, closing the message pipe and leaving the interface
101 // implementation unbound. 101 // implementation unbound.
102 ~Binding() override { 102 ~Binding() override {
103 if (internal_router_) { 103 if (internal_router_) {
104 internal_router_->CloseMessagePipe();
jamesr 2015/03/12 21:01:10 instead of these two calls could you just call Clo
104 DestroyRouter(); 105 DestroyRouter();
105 } 106 }
106 } 107 }
107 108
108 // Completes a binding that was constructed with only an interface 109 // Completes a binding that was constructed with only an interface
109 // implementation. Takes ownership of |handle| and binds it to the previously 110 // implementation. Takes ownership of |handle| and binds it to the previously
110 // specified implementation. See class comment for definition of |waiter|. 111 // specified implementation. See class comment for definition of |waiter|.
111 void Bind( 112 void Bind(
112 ScopedMessagePipeHandle handle, 113 ScopedMessagePipeHandle handle,
113 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { 114 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 typename Interface::Stub_ stub_; 209 typename Interface::Stub_ stub_;
209 Interface* impl_; 210 Interface* impl_;
210 ErrorHandler* error_handler_ = nullptr; 211 ErrorHandler* error_handler_ = nullptr;
211 212
212 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); 213 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding);
213 }; 214 };
214 215
215 } // namespace mojo 216 } // namespace mojo
216 217
217 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ 218 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698