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

Side by Side Diff: base/pickle.h

Issue 1327523006: base: Fix an inefficiency in base::Pickle that caused extraneous allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from mark. Created 5 years, 3 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
« 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Just like WriteBytes, but with a compile-time size, for performance. 289 // Just like WriteBytes, but with a compile-time size, for performance.
290 template<size_t length> void BASE_EXPORT WriteBytesStatic(const void* data); 290 template<size_t length> void BASE_EXPORT WriteBytesStatic(const void* data);
291 291
292 // Writes a POD by copying its bytes. 292 // Writes a POD by copying its bytes.
293 template <typename T> bool WritePOD(const T& data) { 293 template <typename T> bool WritePOD(const T& data) {
294 WriteBytesStatic<sizeof(data)>(&data); 294 WriteBytesStatic<sizeof(data)>(&data);
295 return true; 295 return true;
296 } 296 }
297 inline void WriteBytesCommon(const void* data, size_t length); 297 inline void WriteBytesCommon(const void* data, size_t length);
298 298
299 FRIEND_TEST_ALL_PREFIXES(PickleTest, DeepCopyResize);
299 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); 300 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize);
300 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); 301 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext);
301 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); 302 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader);
302 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow); 303 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextOverflow);
303 }; 304 };
304 305
305 } // namespace base 306 } // namespace base
306 307
307 #endif // BASE_PICKLE_H_ 308 #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