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

Unified Diff: base/pickle.cc

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/pickle.h ('k') | 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
diff --git a/base/pickle.cc b/base/pickle.cc
index d4487d45b24d61238309d3db48b1f17f4f2e0cca..a7cfae57bd96a51834f7da9717d7d4157f06447e 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -254,8 +254,8 @@ Pickle::Pickle(const Pickle& other)
header_size_(other.header_size_),
capacity_after_header_(0),
write_offset_(other.write_offset_) {
+ Resize(other.header_->payload_size);
size_t payload_size = header_size_ + other.header_->payload_size;
Mark Mentovai 2015/09/08 23:25:17 This isn’t useful as a standalone variable now, yo
erikchen 2015/09/08 23:33:39 Done.
- Resize(payload_size);
memcpy(header_, other.header_, payload_size);
}
« no previous file with comments | « base/pickle.h ('k') | base/pickle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698