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

Unified Diff: mojo/public/cpp/bindings/interface_ptr.h

Issue 272323003: Mojo: Implement support for |Foo&| mojom syntax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/interface_impl.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/interface_ptr.h
diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h
index 6d47a8621739c1de1a9b8e1d34e8ee84558db347..266cda0035531a9593c0eed91903aad1aa5e8103 100644
--- a/mojo/public/cpp/bindings/interface_ptr.h
+++ b/mojo/public/cpp/bindings/interface_ptr.h
@@ -24,10 +24,11 @@ class InterfacePtr {
InterfacePtr() {}
InterfacePtr(RValue other) {
- other.object->internal_state_.Swap(&internal_state_);
+ internal_state_.Swap(&other.object->internal_state_);
}
InterfacePtr& operator=(RValue other) {
- other.object->internal_state_.Swap(&internal_state_);
+ reset();
+ internal_state_.Swap(&other.object->internal_state_);
return *this;
}
@@ -37,7 +38,7 @@ class InterfacePtr {
return internal_state_.instance();
}
Interface* operator->() const { return get(); }
- Interface* operator*() const { return get(); }
+ Interface& operator*() const { return *get(); }
void reset() {
State doomed;
@@ -84,11 +85,11 @@ class InterfacePtr {
// Returns the underlying message pipe handle (if any) and resets the
// InterfacePtr<..> to its uninitialized state. This method is helpful if you
// need to move a proxy to another thread. See related notes for Bind.
- ScopedMessagePipeHandle ResetAndReturnMessagePipe() {
+ ScopedMessagePipeHandle PassMessagePipe() {
State state;
internal_state_.Swap(&state);
return state.router() ?
- state.router()->ReleaseMessagePipe() : ScopedMessagePipeHandle();
+ state.router()->PassMessagePipe() : ScopedMessagePipeHandle();
}
// DO NOT USE. Exposed only for internal use and for testing.
« no previous file with comments | « mojo/public/cpp/bindings/interface_impl.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698