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

Unified Diff: url/url_canon.h

Issue 2641823004: [url] Reserve size in a smarter way to account for pre-allocated buffers (Closed)
Patch Set: Created 3 years, 11 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 | url/url_canon_relative.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_canon.h
diff --git a/url/url_canon.h b/url/url_canon.h
index ff66c6e3086172730eec5112cd4a8899d1a8afcc..d093f359fe18f244184b1163311b6fa8b4ac2e97 100644
--- a/url/url_canon.h
+++ b/url/url_canon.h
@@ -118,8 +118,9 @@ class CanonOutputT {
}
void ReserveSizeIfNeeded(int estimated_size) {
+ // Reserve a bit extra to account for escaped chars.
if (estimated_size > buffer_len_)
- Resize(estimated_size);
+ Resize(estimated_size + 8);
}
protected:
« no previous file with comments | « no previous file | url/url_canon_relative.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698