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

Unified Diff: mojo/system/local_message_pipe_endpoint.h

Issue 147983009: Mojo: Refactor some message pipe stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/system/local_message_pipe_endpoint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/local_message_pipe_endpoint.h
diff --git a/mojo/system/local_message_pipe_endpoint.h b/mojo/system/local_message_pipe_endpoint.h
index 2003bc2c0c5fcbf872766b5105c93b2fa6073f3e..9fcc52c86d4d60c274c4fc9a6076c074b50feb92 100644
--- a/mojo/system/local_message_pipe_endpoint.h
+++ b/mojo/system/local_message_pipe_endpoint.h
@@ -27,12 +27,9 @@ class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint
// |MessagePipeEndpoint| implementation:
virtual void Close() OVERRIDE;
virtual void OnPeerClose() OVERRIDE;
- virtual MojoResult CanEnqueueMessage(
- const MessageInTransit* message,
- const std::vector<Dispatcher*>* dispatchers) OVERRIDE;
- virtual void EnqueueMessage(
+ virtual MojoResult EnqueueMessage(
MessageInTransit* message,
- std::vector<scoped_refptr<Dispatcher> >* dispatchers) OVERRIDE;
+ const std::vector<Dispatcher*>* dispatchers) OVERRIDE;
// There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to
// implement/override these:
@@ -48,7 +45,8 @@ class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint
virtual void RemoveWaiter(Waiter* waiter) OVERRIDE;
private:
- struct MessageQueueEntry {
+ class MessageQueueEntry {
+ public:
MessageQueueEntry();
// Provide an explicit copy constructor, so that we can use this directly in
// a (C++03) STL container. However, we only allow the case where |other| is
@@ -57,10 +55,25 @@ class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint
MessageQueueEntry(const MessageQueueEntry& other);
~MessageQueueEntry();
- MessageInTransit* message;
- std::vector<scoped_refptr<Dispatcher> > dispatchers;
+ // Initialize, taking ownership of |message| and creating equivalent
+ // "duplicate" |dispatchers|. |dispatchers| should be non-null only if
+ // nonempty.
+ // TODO(vtl): This would simply be a constructor, but we don't have C++11's
+ // emplace operations yet, and I don't want to copy |dispatchers_|.
+ void Init(MessageInTransit* message,
+ const std::vector<Dispatcher*>* dispatchers);
+
+ MessageInTransit* message() {
+ return message_;
+ }
+ std::vector<scoped_refptr<Dispatcher> >* dispatchers() {
+ return &dispatchers_;
+ }
private:
+ MessageInTransit* message_;
+ std::vector<scoped_refptr<Dispatcher> > dispatchers_;
+
// We don't need assignment, however.
DISALLOW_ASSIGN(MessageQueueEntry);
};
« no previous file with comments | « no previous file | mojo/system/local_message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698