OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_PICKLE_H__ | 5 #ifndef BASE_PICKLE_H__ |
6 #define BASE_PICKLE_H__ | 6 #define BASE_PICKLE_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 Header* header_; | 330 Header* header_; |
331 size_t header_size_; // Supports extra data between header and payload. | 331 size_t header_size_; // Supports extra data between header and payload. |
332 // Allocation size of payload (or -1 if allocation is const). Note: this | 332 // Allocation size of payload (or -1 if allocation is const). Note: this |
333 // doesn't count the header. | 333 // doesn't count the header. |
334 size_t capacity_after_header_; | 334 size_t capacity_after_header_; |
335 // The offset at which we will write the next field. Note: this doesn't count | 335 // The offset at which we will write the next field. Note: this doesn't count |
336 // the header. | 336 // the header. |
337 size_t write_offset_; | 337 size_t write_offset_; |
338 | 338 |
339 // Just like WriteBytes, but with a compile-time size, for performance. | 339 // Just like WriteBytes, but with a compile-time size, for performance. |
340 template<size_t length> void WriteBytesStatic(const void* data); | 340 template<size_t length> void BASE_EXPORT WriteBytesStatic(const void* data); |
341 | 341 |
342 // Writes a POD by copying its bytes. | 342 // Writes a POD by copying its bytes. |
343 template <typename T> bool WritePOD(const T& data) { | 343 template <typename T> bool WritePOD(const T& data) { |
344 WriteBytesStatic<sizeof(data)>(&data); | 344 WriteBytesStatic<sizeof(data)>(&data); |
345 return true; | 345 return true; |
346 } | 346 } |
347 inline void WriteBytesCommon(const void* data, size_t length); | 347 inline void WriteBytesCommon(const void* data, size_t length); |
348 | 348 |
349 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); | 349 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); |
350 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); | 350 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); |
351 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); | 351 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); |
352 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); | 352 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); |
353 }; | 353 }; |
354 | 354 |
355 #endif // BASE_PICKLE_H__ | 355 #endif // BASE_PICKLE_H__ |
OLD | NEW |