| 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> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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_IMPL_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 virtual void OnPeerClose() = 0; | 39 virtual void OnPeerClose() = 0; |
| 40 // Checks if |EnqueueMessage()| will be able to enqueue the given message | 40 // Implements |MessagePipe::EnqueueMessage()| (see its description for |
| 41 // (with the given set of dispatchers). |dispatchers| should be non-null only | 41 // details). |
| 42 // if it's nonempty. Returns |MOJO_RESULT_OK| if it will and an appropriate | 42 virtual MojoResult EnqueueMessage( |
| 43 // error code if it won't. | 43 MessageInTransit* message, |
| 44 virtual MojoResult CanEnqueueMessage( | |
| 45 const MessageInTransit* message, | |
| 46 const std::vector<Dispatcher*>* dispatchers) = 0; | 44 const std::vector<Dispatcher*>* dispatchers) = 0; |
| 47 // Takes ownership of |message| and the contents of |dispatchers| (leaving | |
| 48 // it empty). This should only be called after |CanEnqueueMessage()| has | |
| 49 // indicated success. (Unlike |CanEnqueueMessage()|, |dispatchers| may be | |
| 50 // non-null but empty.) | |
| 51 virtual void EnqueueMessage( | |
| 52 MessageInTransit* message, | |
| 53 std::vector<scoped_refptr<Dispatcher> >* dispatchers) = 0; | |
| 54 | 45 |
| 55 // Implementations must override these if they represent a local endpoint, | 46 // Implementations must override these if they represent a local endpoint, |
| 56 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). | 47 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). |
| 57 // An implementation for a proxy endpoint (for which there's no dispatcher) | 48 // An implementation for a proxy endpoint (for which there's no dispatcher) |
| 58 // needs not override these methods, since they should never be called. | 49 // needs not override these methods, since they should never be called. |
| 59 // | 50 // |
| 60 // These methods implement the methods of the same name in |MessagePipe|, | 51 // These methods implement the methods of the same name in |MessagePipe|, |
| 61 // though |MessagePipe|'s implementation may have to do a little more if the | 52 // though |MessagePipe|'s implementation may have to do a little more if the |
| 62 // operation involves both endpoints. | 53 // operation involves both endpoints. |
| 63 virtual void CancelAllWaiters(); | 54 virtual void CancelAllWaiters(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 MessagePipeEndpoint() {} | 73 MessagePipeEndpoint() {} |
| 83 | 74 |
| 84 private: | 75 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); | 76 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); |
| 86 }; | 77 }; |
| 87 | 78 |
| 88 } // namespace system | 79 } // namespace system |
| 89 } // namespace mojo | 80 } // namespace mojo |
| 90 | 81 |
| 91 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 82 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
| OLD | NEW |