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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 MojoResult AddWaiter(unsigned port, | 61 MojoResult AddWaiter(unsigned port, |
62 Waiter* waiter, | 62 Waiter* waiter, |
63 MojoWaitFlags flags, | 63 MojoWaitFlags flags, |
64 MojoResult wake_result); | 64 MojoResult wake_result); |
65 void RemoveWaiter(unsigned port, Waiter* waiter); | 65 void RemoveWaiter(unsigned port, Waiter* waiter); |
66 | 66 |
67 // This is used internally by |WriteMessage()| and by |Channel| to enqueue | 67 // This is used internally by |WriteMessage()| and by |Channel| to enqueue |
68 // messages (typically to a |LocalMessagePipeEndpoint|). Unlike | 68 // messages (typically to a |LocalMessagePipeEndpoint|). Unlike |
69 // |WriteMessage()|, |port| is the *destination* port. Takes ownership of | 69 // |WriteMessage()|, |port| is the *destination* port. Takes ownership of |
70 // |message|. | 70 // |message|. |
71 MojoResult EnqueueMessage(unsigned port, MessageInTransit* message); | 71 MojoResult EnqueueMessage(unsigned port, |
| 72 MessageInTransit* message, |
| 73 const std::vector<Dispatcher*>* dispatchers); |
72 | 74 |
73 // These are used by |Channel|. | 75 // These are used by |Channel|. |
74 void Attach(unsigned port, | 76 void Attach(unsigned port, |
75 scoped_refptr<Channel> channel, | 77 scoped_refptr<Channel> channel, |
76 MessageInTransit::EndpointId local_id); | 78 MessageInTransit::EndpointId local_id); |
77 void Run(unsigned port, MessageInTransit::EndpointId remote_id); | 79 void Run(unsigned port, MessageInTransit::EndpointId remote_id); |
78 | 80 |
79 private: | 81 private: |
80 friend class base::RefCountedThreadSafe<MessagePipe>; | 82 friend class base::RefCountedThreadSafe<MessagePipe>; |
81 virtual ~MessagePipe(); | 83 virtual ~MessagePipe(); |
82 | 84 |
83 // Used by |EnqueueMessage()| to handle control messages that are actually | 85 // Used by |EnqueueMessage()| to handle control messages that are actually |
84 // meant for us. | 86 // meant for us. |
85 MojoResult HandleControlMessage(unsigned port, MessageInTransit* message); | 87 MojoResult HandleControlMessage(unsigned port, MessageInTransit* message); |
86 | 88 |
87 base::Lock lock_; // Protects the following members. | 89 base::Lock lock_; // Protects the following members. |
88 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 90 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
89 | 91 |
90 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 92 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
91 }; | 93 }; |
92 | 94 |
93 } // namespace system | 95 } // namespace system |
94 } // namespace mojo | 96 } // namespace mojo |
95 | 97 |
96 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ | 98 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |