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_IN_TRANSIT_H_ | 5 #ifndef MOJO_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
6 #define MOJO_SYSTEM_MESSAGE_IN_TRANSIT_H_ | 6 #define MOJO_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // Rounds |n| up to a multiple of |kMessageAlignment|. | 236 // Rounds |n| up to a multiple of |kMessageAlignment|. |
237 static inline size_t RoundUpMessageAlignment(size_t n) { | 237 static inline size_t RoundUpMessageAlignment(size_t n) { |
238 return (n + kMessageAlignment - 1) & ~(kMessageAlignment - 1); | 238 return (n + kMessageAlignment - 1) & ~(kMessageAlignment - 1); |
239 } | 239 } |
240 | 240 |
241 private: | 241 private: |
242 // To allow us to make assertions about |Header| in the .cc file. | 242 // To allow us to make assertions about |Header| in the .cc file. |
243 struct PrivateStructForCompileAsserts; | 243 struct PrivateStructForCompileAsserts; |
244 | 244 |
245 // "Header" for the data. Must be a multiple of |kMessageAlignment| bytes in | 245 // Header for the data (main buffer). Must be a multiple of |
246 // size. Must be POD. | 246 // |kMessageAlignment| bytes in size. Must be POD. |
247 struct Header { | 247 struct Header { |
248 // Total size of the message, including the header, the message data | 248 // Total size of the message, including the header, the message data |
249 // ("bytes") including padding (to make it a multiple of |kMessageAlignment| | 249 // ("bytes") including padding (to make it a multiple of |kMessageAlignment| |
250 // bytes), and serialized handle information. Note that this may not be the | 250 // bytes), and serialized handle information. Note that this may not be the |
251 // correct value if dispatchers are attached but | 251 // correct value if dispatchers are attached but |
252 // |SerializeAndCloseDispatchers()| has not been called. | 252 // |SerializeAndCloseDispatchers()| has not been called. |
253 uint32_t total_size; | 253 uint32_t total_size; |
254 Type type; // 2 bytes. | 254 Type type; // 2 bytes. |
255 Subtype subtype; // 2 bytes. | 255 Subtype subtype; // 2 bytes. |
256 EndpointId source_id; // 4 bytes. | 256 EndpointId source_id; // 4 bytes. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandles|. | 305 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandles|. |
306 scoped_ptr<std::vector<embedder::PlatformHandle> > platform_handles_; | 306 scoped_ptr<std::vector<embedder::PlatformHandle> > platform_handles_; |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(MessageInTransit); | 308 DISALLOW_COPY_AND_ASSIGN(MessageInTransit); |
309 }; | 309 }; |
310 | 310 |
311 } // namespace system | 311 } // namespace system |
312 } // namespace mojo | 312 } // namespace mojo |
313 | 313 |
314 #endif // MOJO_SYSTEM_MESSAGE_IN_TRANSIT_H_ | 314 #endif // MOJO_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
OLD | NEW |