OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TRANSPORT_DATA_H_ | 5 #ifndef MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ | 6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 // |MessageInTransit::kMessageAlignment| in size. Must be POD. | 155 // |MessageInTransit::kMessageAlignment| in size. Must be POD. |
156 struct Header { | 156 struct Header { |
157 uint32_t num_handles; | 157 uint32_t num_handles; |
158 // TODO(vtl): Not used yet: | 158 // TODO(vtl): Not used yet: |
159 uint32_t platform_handle_table_offset; | 159 uint32_t platform_handle_table_offset; |
160 uint32_t num_platform_handles; | 160 uint32_t num_platform_handles; |
161 uint32_t unused; | 161 uint32_t unused; |
162 }; | 162 }; |
163 | 163 |
164 struct HandleTableEntry { | 164 struct HandleTableEntry { |
165 int32_t type; // From |Dispatcher::Type| (|kTypeUnknown| for "invalid"). | 165 // TODO(vtl): Should I make |Dispatcher::Type| an |int32_t| enum class? |
yzshen1
2015/06/01 15:48:17
I wonder what are the reasons not to make it sized
| |
166 int32_t type; // From |Dispatcher::Type| (|UNKNOWN| for "invalid"). | |
166 uint32_t offset; // Relative to the start of the "secondary buffer". | 167 uint32_t offset; // Relative to the start of the "secondary buffer". |
167 uint32_t size; // (Not including any padding.) | 168 uint32_t size; // (Not including any padding.) |
168 uint32_t unused; | 169 uint32_t unused; |
169 }; | 170 }; |
170 | 171 |
171 const Header* header() const { | 172 const Header* header() const { |
172 return reinterpret_cast<const Header*>(buffer_.get()); | 173 return reinterpret_cast<const Header*>(buffer_.get()); |
173 } | 174 } |
174 | 175 |
175 size_t buffer_size_; | 176 size_t buffer_size_; |
176 scoped_ptr<char, base::AlignedFreeDeleter> buffer_; // Never null. | 177 scoped_ptr<char, base::AlignedFreeDeleter> buffer_; // Never null. |
177 | 178 |
178 // Any platform-specific handles attached to this message (for inter-process | 179 // Any platform-specific handles attached to this message (for inter-process |
179 // transport). The vector (if any) owns the handles that it contains (and is | 180 // transport). The vector (if any) owns the handles that it contains (and is |
180 // responsible for closing them). | 181 // responsible for closing them). |
181 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s. | 182 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s. |
182 embedder::ScopedPlatformHandleVectorPtr platform_handles_; | 183 embedder::ScopedPlatformHandleVectorPtr platform_handles_; |
183 | 184 |
184 DISALLOW_COPY_AND_ASSIGN(TransportData); | 185 DISALLOW_COPY_AND_ASSIGN(TransportData); |
185 }; | 186 }; |
186 | 187 |
187 } // namespace system | 188 } // namespace system |
188 } // namespace mojo | 189 } // namespace mojo |
189 | 190 |
190 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ | 191 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ |
OLD | NEW |