| 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 12 matching lines...) Expand all Loading... |
| 23 class MessagePipeEndpoint; | 23 class MessagePipeEndpoint; |
| 24 class Waiter; | 24 class Waiter; |
| 25 | 25 |
| 26 // |MessagePipe| is the secondary object implementing a message pipe (see the | 26 // |MessagePipe| is the secondary object implementing a message pipe (see the |
| 27 // explanatory comment in core_impl.cc). It is typically owned by the | 27 // explanatory comment in core_impl.cc). It is typically owned by the |
| 28 // dispatcher(s) corresponding to the local endpoints. This class is | 28 // dispatcher(s) corresponding to the local endpoints. This class is |
| 29 // thread-safe. | 29 // thread-safe. |
| 30 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : | 30 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : |
| 31 public base::RefCountedThreadSafe<MessagePipe> { | 31 public base::RefCountedThreadSafe<MessagePipe> { |
| 32 public: | 32 public: |
| 33 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint_0, | 33 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint0, |
| 34 scoped_ptr<MessagePipeEndpoint> endpoint_1); | 34 scoped_ptr<MessagePipeEndpoint> endpoint1); |
| 35 | 35 |
| 36 // Convenience constructor that constructs a |MessagePipe| with two new | 36 // Convenience constructor that constructs a |MessagePipe| with two new |
| 37 // |LocalMessagePipeEndpoint|s. | 37 // |LocalMessagePipeEndpoint|s. |
| 38 MessagePipe(); | 38 MessagePipe(); |
| 39 | 39 |
| 40 // Gets the other port number (i.e., 0 -> 1, 1 -> 0). | 40 // Gets the other port number (i.e., 0 -> 1, 1 -> 0). |
| 41 static unsigned GetPeerPort(unsigned port); | 41 static unsigned GetPeerPort(unsigned port); |
| 42 | 42 |
| 43 // These are called by the dispatcher to implement its methods of | 43 // These are called by the dispatcher to implement its methods of |
| 44 // corresponding names. In all cases, the port |port| must be open. | 44 // corresponding names. In all cases, the port |port| must be open. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |