| 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_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
| 6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "mojo/public/system/core.h" | 14 #include "mojo/public/system/core.h" |
| 15 #include "mojo/public/system/system_export.h" | |
| 16 #include "mojo/system/message_in_transit.h" | 15 #include "mojo/system/message_in_transit.h" |
| 16 #include "mojo/system/system_impl_export.h" |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace system { | 19 namespace system { |
| 20 | 20 |
| 21 class Channel; | 21 class Channel; |
| 22 class Dispatcher; | 22 class Dispatcher; |
| 23 class Waiter; | 23 class Waiter; |
| 24 | 24 |
| 25 // This is an interface to one of the ends of a message pipe, and is used by | 25 // This is an interface to one of the ends of a message pipe, and is used by |
| 26 // |MessagePipe|. Its most important role is to provide a sink for messages | 26 // |MessagePipe|. Its most important role is to provide a sink for messages |
| 27 // (i.e., a place where messages can be sent). It has a secondary role: When the | 27 // (i.e., a place where messages can be sent). It has a secondary role: When the |
| 28 // endpoint is local (i.e., in the current process), there'll be a dispatcher | 28 // endpoint is local (i.e., in the current process), there'll be a dispatcher |
| 29 // corresponding to the endpoint. In that case, the implementation of | 29 // corresponding to the endpoint. In that case, the implementation of |
| 30 // |MessagePipeEndpoint| also implements the functionality required by the | 30 // |MessagePipeEndpoint| also implements the functionality required by the |
| 31 // dispatcher, e.g., to read messages and to wait. Implementations of this class | 31 // dispatcher, e.g., to read messages and to wait. Implementations of this class |
| 32 // are not thread-safe; instances are protected by |MesssagePipe|'s lock. | 32 // are not thread-safe; instances are protected by |MesssagePipe|'s lock. |
| 33 class MOJO_SYSTEM_EXPORT MessagePipeEndpoint { | 33 class MOJO_SYSTEM_IMPL_EXPORT MessagePipeEndpoint { |
| 34 public: | 34 public: |
| 35 virtual ~MessagePipeEndpoint() {} | 35 virtual ~MessagePipeEndpoint() {} |
| 36 | 36 |
| 37 // All implementations must implement these. | 37 // All implementations must implement these. |
| 38 virtual void Close() = 0; | 38 virtual void Close() = 0; |
| 39 // Returns false if the endpoint should be closed and destroyed, else true. | 39 // Returns false if the endpoint should be closed and destroyed, else true. |
| 40 virtual bool OnPeerClose() = 0; | 40 virtual bool OnPeerClose() = 0; |
| 41 // Checks if |EnqueueMessage()| will be able to enqueue the given message | 41 // Checks if |EnqueueMessage()| will be able to enqueue the given message |
| 42 // (with the given set of dispatchers). |dispatchers| should be non-null only | 42 // (with the given set of dispatchers). |dispatchers| should be non-null only |
| 43 // if it's nonempty. Returns |MOJO_RESULT_OK| if it will and an appropriate | 43 // if it's nonempty. Returns |MOJO_RESULT_OK| if it will and an appropriate |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 MessagePipeEndpoint() {} | 84 MessagePipeEndpoint() {} |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); | 87 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace system | 90 } // namespace system |
| 91 } // namespace mojo | 91 } // namespace mojo |
| 92 | 92 |
| 93 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 93 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
| OLD | NEW |