| 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 <list> | 8 #include <list> |
| 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/system/core.h" | 14 #include "mojo/public/system/core.h" |
| 15 #include "mojo/public/system/system_export.h" |
| 15 #include "mojo/system/waiter_list.h" | 16 #include "mojo/system/waiter_list.h" |
| 16 | 17 |
| 17 namespace mojo { | 18 namespace mojo { |
| 18 namespace system { | 19 namespace system { |
| 19 | 20 |
| 20 class MessageInTransit; | 21 class MessageInTransit; |
| 21 class Waiter; | 22 class Waiter; |
| 22 | 23 |
| 23 // |MessagePipe| is the secondary object implementing a message pipe (see the | 24 // |MessagePipe| is the secondary object implementing a message pipe (see the |
| 24 // explanatory comment in core_impl.cc), and is jointly owned by the two | 25 // explanatory comment in core_impl.cc), and is jointly owned by the two |
| 25 // dispatchers passed in to the constructor. This class is thread-safe. | 26 // dispatchers passed in to the constructor. This class is thread-safe. |
| 26 class MessagePipe : public base::RefCountedThreadSafe<MessagePipe> { | 27 class MOJO_SYSTEM_EXPORT MessagePipe : |
| 28 public base::RefCountedThreadSafe<MessagePipe> { |
| 27 public: | 29 public: |
| 28 MessagePipe(); | 30 MessagePipe(); |
| 29 | 31 |
| 30 // These are called by the dispatcher to implement its methods of | 32 // These are called by the dispatcher to implement its methods of |
| 31 // corresponding names. In all cases, the port |port| must be open. | 33 // corresponding names. In all cases, the port |port| must be open. |
| 32 void CancelAllWaiters(unsigned port); | 34 void CancelAllWaiters(unsigned port); |
| 33 void Close(unsigned port); | 35 void Close(unsigned port); |
| 34 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its | 36 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its |
| 35 // arguments. |bytes|/|num_bytes| and |handles|/|num_handles| must be valid. | 37 // arguments. |bytes|/|num_bytes| and |handles|/|num_handles| must be valid. |
| 36 MojoResult WriteMessage(unsigned port, | 38 MojoResult WriteMessage(unsigned port, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 66 std::list<MessageInTransit*> message_queues_[2]; | 68 std::list<MessageInTransit*> message_queues_[2]; |
| 67 WaiterList waiter_lists_[2]; | 69 WaiterList waiter_lists_[2]; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 71 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace system | 74 } // namespace system |
| 73 } // namespace mojo | 75 } // namespace mojo |
| 74 | 76 |
| 75 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ | 77 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |