| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void* destination, | 114 void* destination, |
| 115 size_t* actual_size, | 115 size_t* actual_size, |
| 116 embedder::PlatformHandleVector* platform_handles); | 116 embedder::PlatformHandleVector* platform_handles); |
| 117 | 117 |
| 118 // |ChannelEndpointClient| methods: | 118 // |ChannelEndpointClient| methods: |
| 119 bool OnReadMessage(unsigned port, MessageInTransit* message) override; | 119 bool OnReadMessage(unsigned port, MessageInTransit* message) override; |
| 120 void OnDetachFromChannel(unsigned port) override; | 120 void OnDetachFromChannel(unsigned port) override; |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 MessagePipe(); | 123 MessagePipe(); |
| 124 virtual ~MessagePipe(); | 124 ~MessagePipe() override; |
| 125 | 125 |
| 126 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. | 126 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. |
| 127 // |transports| may be non-null only if it's nonempty and |message| has no | 127 // |transports| may be non-null only if it's nonempty and |message| has no |
| 128 // dispatchers attached. Must be called with |lock_| held. | 128 // dispatchers attached. Must be called with |lock_| held. |
| 129 MojoResult EnqueueMessageNoLock(unsigned port, | 129 MojoResult EnqueueMessageNoLock(unsigned port, |
| 130 scoped_ptr<MessageInTransit> message, | 130 scoped_ptr<MessageInTransit> message, |
| 131 std::vector<DispatcherTransport>* transports); | 131 std::vector<DispatcherTransport>* transports); |
| 132 | 132 |
| 133 // Helper for |EnqueueMessageNoLock()|. Must be called with |lock_| held. | 133 // Helper for |EnqueueMessageNoLock()|. Must be called with |lock_| held. |
| 134 MojoResult AttachTransportsNoLock( | 134 MojoResult AttachTransportsNoLock( |
| 135 unsigned port, | 135 unsigned port, |
| 136 MessageInTransit* message, | 136 MessageInTransit* message, |
| 137 std::vector<DispatcherTransport>* transports); | 137 std::vector<DispatcherTransport>* transports); |
| 138 | 138 |
| 139 base::Lock lock_; // Protects the following members. | 139 base::Lock lock_; // Protects the following members. |
| 140 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 140 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 142 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace system | 145 } // namespace system |
| 146 } // namespace mojo | 146 } // namespace mojo |
| 147 | 147 |
| 148 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 148 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |