Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: base/pickle.h

Issue 298913006: Pickle: don't mark these methods inline when they're not (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/pickle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 private: 56 private:
57 // Aligns 'i' by rounding it up to the next multiple of 'alignment' 57 // Aligns 'i' by rounding it up to the next multiple of 'alignment'
58 static size_t AlignInt(size_t i, int alignment) { 58 static size_t AlignInt(size_t i, int alignment) {
59 return i + (alignment - (i % alignment)) % alignment; 59 return i + (alignment - (i % alignment)) % alignment;
60 } 60 }
61 61
62 // Read Type from Pickle. 62 // Read Type from Pickle.
63 template <typename Type> 63 template <typename Type>
64 inline bool ReadBuiltinType(Type* result); 64 bool ReadBuiltinType(Type* result);
65 65
66 // Get read pointer for Type and advance read pointer. 66 // Get read pointer for Type and advance read pointer.
67 template<typename Type> 67 template<typename Type>
68 inline const char* GetReadPointerAndAdvance(); 68 const char* GetReadPointerAndAdvance();
69 69
70 // Get read pointer for |num_bytes| and advance read pointer. This method 70 // Get read pointer for |num_bytes| and advance read pointer. This method
71 // checks num_bytes for negativity and wrapping. 71 // checks num_bytes for negativity and wrapping.
72 const char* GetReadPointerAndAdvance(int num_bytes); 72 const char* GetReadPointerAndAdvance(int num_bytes);
73 73
74 // Get read pointer for (num_elements * size_element) bytes and advance read 74 // Get read pointer for (num_elements * size_element) bytes and advance read
75 // pointer. This method checks for int overflow, negativity and wrapping. 75 // pointer. This method checks for int overflow, negativity and wrapping.
76 inline const char* GetReadPointerAndAdvance(int num_elements, 76 const char* GetReadPointerAndAdvance(int num_elements, size_t size_element);
77 size_t size_element);
78 77
79 // Pointers to the Pickle data. 78 // Pointers to the Pickle data.
80 const char* read_ptr_; 79 const char* read_ptr_;
81 const char* read_end_ptr_; 80 const char* read_end_ptr_;
82 81
83 FRIEND_TEST_ALL_PREFIXES(PickleTest, GetReadPointerAndAdvance); 82 FRIEND_TEST_ALL_PREFIXES(PickleTest, GetReadPointerAndAdvance);
84 }; 83 };
85 84
86 // This class provides facilities for basic binary value packing and unpacking. 85 // This class provides facilities for basic binary value packing and unpacking.
87 // 86 //
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 size_t write_offset_; 329 size_t write_offset_;
331 330
332 // Just like WriteBytes, but with a compile-time size, for performance. 331 // Just like WriteBytes, but with a compile-time size, for performance.
333 template<size_t length> void WriteBytesStatic(const void* data); 332 template<size_t length> void WriteBytesStatic(const void* data);
334 333
335 // Writes a POD by copying its bytes. 334 // Writes a POD by copying its bytes.
336 template <typename T> bool WritePOD(const T& data) { 335 template <typename T> bool WritePOD(const T& data) {
337 WriteBytesStatic<sizeof(data)>(&data); 336 WriteBytesStatic<sizeof(data)>(&data);
338 return true; 337 return true;
339 } 338 }
340 inline void WriteBytesCommon(const void* data, size_t length); 339 void WriteBytesCommon(const void* data, size_t length);
341 340
342 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); 341 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize);
343 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); 342 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext);
344 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); 343 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader);
345 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); 344 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow);
346 }; 345 };
347 346
348 #endif // BASE_PICKLE_H__ 347 #endif // BASE_PICKLE_H__
OLDNEW
« no previous file with comments | « no previous file | base/pickle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698