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

Unified Diff: base/pickle.cc

Issue 46056: Change Pickle to double its capacity by default, rather than increasing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/pickle_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.cc
===================================================================
--- base/pickle.cc (revision 11625)
+++ base/pickle.cc (working copy)
@@ -263,7 +263,8 @@
size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
size_t new_size = offset + length;
- if (header_size_ + new_size > capacity_ && !Resize(header_size_ + new_size))
+ size_t needed_size = header_size_ + new_size;
+ if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
return NULL;
#ifdef ARCH_CPU_64_BITS
« no previous file with comments | « no previous file | base/pickle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698