OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ | 5 #ifndef COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ |
6 #define COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ | 6 #define COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <type_traits> | 10 #include <type_traits> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // nested messages are finalized and sealed when any other field is set in the | 192 // nested messages are finalized and sealed when any other field is set in the |
193 // parent message (or the parent message itself is finalized) and cannot be | 193 // parent message (or the parent message itself is finalized) and cannot be |
194 // accessed anymore afterwards. | 194 // accessed anymore afterwards. |
195 ProtoZeroMessage* nested_message_; | 195 ProtoZeroMessage* nested_message_; |
196 | 196 |
197 // The root message owns the storage for all its nested messages, up to a max | 197 // The root message owns the storage for all its nested messages, up to a max |
198 // of kMaxNestingDepth levels (see the .cc file). Note that the boundaries of | 198 // of kMaxNestingDepth levels (see the .cc file). Note that the boundaries of |
199 // the arena are meaningful only for the root message. The static_assert in | 199 // the arena are meaningful only for the root message. The static_assert in |
200 // the .cc file guarantees that the sizeof(nested_messages_arena_) is enough | 200 // the .cc file guarantees that the sizeof(nested_messages_arena_) is enough |
201 // to contain up to kMaxNestingDepth messages. | 201 // to contain up to kMaxNestingDepth messages. |
202 ALIGNAS(sizeof(void*)) uint8_t nested_messages_arena_[512]; | 202 alignas(sizeof(void*)) uint8_t nested_messages_arena_[512]; |
203 | 203 |
204 // DO NOT add any fields below |nested_messages_arena_|. The memory layout of | 204 // DO NOT add any fields below |nested_messages_arena_|. The memory layout of |
205 // nested messages would overflow the storage allocated by the root message. | 205 // nested messages would overflow the storage allocated by the root message. |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(ProtoZeroMessage); | 207 DISALLOW_COPY_AND_ASSIGN(ProtoZeroMessage); |
208 }; | 208 }; |
209 | 209 |
210 } // namespace v2 | 210 } // namespace v2 |
211 } // namespace tracing | 211 } // namespace tracing |
212 | 212 |
213 #endif // COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ | 213 #endif // COMPONENTS_TRACING_CORE_PROTO_ZERO_MESSAGE_H_ |
OLD | NEW |