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

Unified Diff: url/url_canon.h

Issue 2617173003: [url] Reserve output buffer for various URL parsing paths (Closed)
Patch Set: brettw review 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 | « url/gurl.cc ('k') | 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 c4852e490b05b0286b463ab23eca0c238eeec52a..ff66c6e3086172730eec5112cd4a8899d1a8afcc 100644
--- a/url/url_canon.h
+++ b/url/url_canon.h
@@ -117,6 +117,11 @@ class CanonOutputT {
cur_len_ += str_len;
}
+ void ReserveSizeIfNeeded(int estimated_size) {
+ if (estimated_size > buffer_len_)
+ Resize(estimated_size);
+ }
+
protected:
// Grows the given buffer so that it can fit at least |min_additional|
// characters. Returns true if the buffer could be resized, false on OOM.
« no previous file with comments | « url/gurl.cc ('k') | url/url_canon_relative.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698