| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYSTEM_MESSAGE_PIPE_H_ | 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_H_ |
| 6 #define MOJO_SYSTEM_MESSAGE_PIPE_H_ | 6 #define MOJO_SYSTEM_MESSAGE_PIPE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 MojoReadMessageFlags flags); | 59 MojoReadMessageFlags flags); |
| 60 MojoResult AddWaiter(unsigned port, | 60 MojoResult AddWaiter(unsigned port, |
| 61 Waiter* waiter, | 61 Waiter* waiter, |
| 62 MojoWaitFlags flags, | 62 MojoWaitFlags flags, |
| 63 MojoResult wake_result); | 63 MojoResult wake_result); |
| 64 void RemoveWaiter(unsigned port, Waiter* waiter); | 64 void RemoveWaiter(unsigned port, Waiter* waiter); |
| 65 | 65 |
| 66 // This is used internally by |WriteMessage()| and by |Channel| to enqueue | 66 // This is used internally by |WriteMessage()| and by |Channel| to enqueue |
| 67 // messages (typically to a |LocalMessagePipeEndpoint|). Unlike | 67 // messages (typically to a |LocalMessagePipeEndpoint|). Unlike |
| 68 // |WriteMessage()|, |port| is the *destination* port. Takes ownership of | 68 // |WriteMessage()|, |port| is the *destination* port. Takes ownership of |
| 69 // |message|. | 69 // |message|. |dispatchers| should be non-null only if it's nonempty. |
| 70 MojoResult EnqueueMessage(unsigned port, | 70 MojoResult EnqueueMessage(unsigned port, |
| 71 MessageInTransit* message, | 71 MessageInTransit* message, |
| 72 const std::vector<Dispatcher*>* dispatchers); | 72 const std::vector<Dispatcher*>* dispatchers); |
| 73 | 73 |
| 74 // These are used by |Channel|. | 74 // These are used by |Channel|. |
| 75 void Attach(unsigned port, | 75 void Attach(unsigned port, |
| 76 scoped_refptr<Channel> channel, | 76 scoped_refptr<Channel> channel, |
| 77 MessageInTransit::EndpointId local_id); | 77 MessageInTransit::EndpointId local_id); |
| 78 void Run(unsigned port, MessageInTransit::EndpointId remote_id); | 78 void Run(unsigned port, MessageInTransit::EndpointId remote_id); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 friend class base::RefCountedThreadSafe<MessagePipe>; | 81 friend class base::RefCountedThreadSafe<MessagePipe>; |
| 82 virtual ~MessagePipe(); | 82 virtual ~MessagePipe(); |
| 83 | 83 |
| 84 // Used by |EnqueueMessage()| to handle control messages that are actually | 84 // Used by |EnqueueMessage()| to handle control messages that are actually |
| 85 // meant for us. | 85 // meant for us. |
| 86 MojoResult HandleControlMessage(unsigned port, MessageInTransit* message); | 86 MojoResult HandleControlMessage(unsigned port, MessageInTransit* message); |
| 87 | 87 |
| 88 base::Lock lock_; // Protects the following members. | 88 base::Lock lock_; // Protects the following members. |
| 89 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 89 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 91 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace system | 94 } // namespace system |
| 95 } // namespace mojo | 95 } // namespace mojo |
| 96 | 96 |
| 97 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ | 97 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |