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

Unified Diff: base/pickle.cc

Issue 35893002: IPC pickling optimization for render passes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ccmessagesperf-reserve: fixbuild Created 7 years, 2 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') | content/common/cc_messages.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 af3191b9d86db2785fe375ecbcb045cf0a420870..4634561928de45f92ea2a127753ec6e089426da5 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -304,6 +304,16 @@ void Pickle::TrimWriteData(int new_length) {
*cur_length = new_length;
}
+void Pickle::Reserve(size_t additional_capacity) {
+ // write at a uint32-aligned offset from the beginning of the header
jar (doing other things) 2013/10/25 01:54:18 nit: Start with Upper case, end with a period. (m
danakj 2013/10/25 18:40:47 Done.
+ size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
+
+ size_t new_size = offset + additional_capacity;
+ size_t needed_size = header_size_ + new_size;
+ if (needed_size > capacity_)
+ Resize(capacity_ * 2 + needed_size);
jar (doing other things) 2013/10/25 01:54:18 Why did you double the existing capacity? Also...
danakj 2013/10/25 18:40:47 For the same reason we double it in BeginWrite().
+}
+
char* Pickle::BeginWrite(size_t length) {
// write at a uint32-aligned offset from the beginning of the header
size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
« no previous file with comments | « base/pickle.h ('k') | content/common/cc_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698