| 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_EDK_SYSTEM_MESSAGE_PIPE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Channel* channel, | 100 Channel* channel, |
| 101 size_t* max_size, | 101 size_t* max_size, |
| 102 size_t* max_platform_handles); | 102 size_t* max_platform_handles); |
| 103 bool EndSerialize(unsigned port, | 103 bool EndSerialize(unsigned port, |
| 104 Channel* channel, | 104 Channel* channel, |
| 105 void* destination, | 105 void* destination, |
| 106 size_t* actual_size, | 106 size_t* actual_size, |
| 107 embedder::PlatformHandleVector* platform_handles); | 107 embedder::PlatformHandleVector* platform_handles); |
| 108 | 108 |
| 109 // |ChannelEndpointClient| methods: | 109 // |ChannelEndpointClient| methods: |
| 110 void OnReadMessage(unsigned port, | 110 bool OnReadMessage(unsigned port, MessageInTransit* message) override; |
| 111 scoped_ptr<MessageInTransit> message) override; | |
| 112 void OnDetachFromChannel(unsigned port) override; | 111 void OnDetachFromChannel(unsigned port) override; |
| 113 | 112 |
| 114 private: | 113 private: |
| 115 MessagePipe(); | 114 MessagePipe(); |
| 116 virtual ~MessagePipe(); | 115 virtual ~MessagePipe(); |
| 117 | 116 |
| 118 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. | 117 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. |
| 119 // |transports| may be non-null only if it's nonempty and |message| has no | 118 // |transports| may be non-null only if it's nonempty and |message| has no |
| 120 // dispatchers attached. | 119 // dispatchers attached. Must be called with |lock_| held. |
| 121 MojoResult EnqueueMessage(unsigned port, | 120 MojoResult EnqueueMessageNoLock(unsigned port, |
| 122 scoped_ptr<MessageInTransit> message, | 121 scoped_ptr<MessageInTransit> message, |
| 123 std::vector<DispatcherTransport>* transports); | 122 std::vector<DispatcherTransport>* transports); |
| 124 | 123 |
| 125 // Helper for |EnqueueMessage()|. Must be called with |lock_| held. | 124 // Helper for |EnqueueMessageNoLock()|. Must be called with |lock_| held. |
| 126 MojoResult AttachTransportsNoLock( | 125 MojoResult AttachTransportsNoLock( |
| 127 unsigned port, | 126 unsigned port, |
| 128 MessageInTransit* message, | 127 MessageInTransit* message, |
| 129 std::vector<DispatcherTransport>* transports); | 128 std::vector<DispatcherTransport>* transports); |
| 130 | 129 |
| 131 base::Lock lock_; // Protects the following members. | 130 base::Lock lock_; // Protects the following members. |
| 132 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 131 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
| 133 | 132 |
| 134 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 133 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace system | 136 } // namespace system |
| 138 } // namespace mojo | 137 } // namespace mojo |
| 139 | 138 |
| 140 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 139 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |