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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "mojo/public/c/system/core.h" | 14 #include "mojo/public/c/system/core.h" |
15 #include "mojo/system/dispatcher.h" | 15 #include "mojo/system/dispatcher.h" |
16 #include "mojo/system/message_in_transit.h" | 16 #include "mojo/system/message_in_transit.h" |
17 #include "mojo/system/message_pipe_endpoint.h" | 17 #include "mojo/system/message_pipe_endpoint.h" |
18 #include "mojo/system/system_impl_export.h" | 18 #include "mojo/system/system_impl_export.h" |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 namespace system { | 21 namespace system { |
22 | 22 |
23 class Channel; | 23 class Channel; |
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.cc). It is typically owned by the dispatcher(s) |
28 // dispatcher(s) corresponding to the local endpoints. This class is | 28 // corresponding to the local endpoints. This class is thread-safe. |
29 // thread-safe. | |
30 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : | 29 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : |
31 public base::RefCountedThreadSafe<MessagePipe> { | 30 public base::RefCountedThreadSafe<MessagePipe> { |
32 public: | 31 public: |
33 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint0, | 32 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint0, |
34 scoped_ptr<MessagePipeEndpoint> endpoint1); | 33 scoped_ptr<MessagePipeEndpoint> endpoint1); |
35 | 34 |
36 // Convenience constructor that constructs a |MessagePipe| with two new | 35 // Convenience constructor that constructs a |MessagePipe| with two new |
37 // |LocalMessagePipeEndpoint|s. | 36 // |LocalMessagePipeEndpoint|s. |
38 MessagePipe(); | 37 MessagePipe(); |
39 | 38 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 base::Lock lock_; // Protects the following members. | 98 base::Lock lock_; // Protects the following members. |
100 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 99 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 101 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
103 }; | 102 }; |
104 | 103 |
105 } // namespace system | 104 } // namespace system |
106 } // namespace mojo | 105 } // namespace mojo |
107 | 106 |
108 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ | 107 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |