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

Unified Diff: mojo/public/bindings/lib/remote_ptr.h

Issue 109103003: Mojo: abstract interface implementation from generated Stub classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/bindings/lib/remote_ptr.h
diff --git a/mojo/public/bindings/lib/remote_ptr.h b/mojo/public/bindings/lib/remote_ptr.h
index 3b57594e23ef0ddf722990d892673ba04ea60c7c..57c11eb8b51c1c1a45ccf0f7fd924a9573108f66 100644
--- a/mojo/public/bindings/lib/remote_ptr.h
+++ b/mojo/public/bindings/lib/remote_ptr.h
@@ -54,8 +54,8 @@ class RemotePtr {
public:
RemotePtr() : state_(NULL) {}
- explicit RemotePtr(ScopedMessagePipeHandle message_pipe)
- : state_(new State(message_pipe.Pass())) {
+ RemotePtr(ScopedMessagePipeHandle message_pipe, typename S::_Peer* peer)
+ : state_(new State(message_pipe.Pass(), peer)) {
}
// Move-only constructor and operator=.
@@ -87,9 +87,9 @@ class RemotePtr {
state_ = NULL;
}
- void reset(ScopedMessagePipeHandle message_pipe) {
+ void reset(ScopedMessagePipeHandle message_pipe, typename S::_Peer* peer) {
delete state_;
- state_ = new State(message_pipe.Pass());
+ state_ = new State(message_pipe.Pass(), peer);
}
bool encountered_error() const {
@@ -97,19 +97,17 @@ class RemotePtr {
return state_->connector.encountered_error();
}
- void SetPeer(typename S::_Peer::_Stub* peer) {
- assert(state_);
- state_->connector.SetIncomingReceiver(peer);
- }
-
private:
struct State {
- State(ScopedMessagePipeHandle message_pipe)
+ State(ScopedMessagePipeHandle message_pipe, typename S::_Peer* peer)
: connector(message_pipe.Pass()),
- proxy(&connector) {
+ proxy(&connector),
+ stub(peer) {
+ connector.SetIncomingReceiver(&stub);
}
internal::Connector connector;
typename S::_Proxy proxy;
+ typename S::_Peer::_Stub stub;
};
State* release() {

Powered by Google App Engine
This is Rietveld 408576698