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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 8005001: Reserve space before building potentially large vectors in safe-browsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | « chrome/browser/safe_browsing/prefix_set.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_database.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index d3276d476ace8c41abe7a115813ba5c7984d3860..1b49ee08e6ae63d1d7c2ff3e3a96c56c51854e26 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -269,6 +269,7 @@ safe_browsing::PrefixSet* PrefixSetFromAddPrefixes(
// |prefixes|. For now, |prefixes| is useful while debugging
// things.
std::vector<SBPrefix> prefixes;
+ prefixes.reserve(add_prefixes.size());
for (size_t i = 0; i < add_prefixes.size(); ++i) {
prefixes.push_back(add_prefixes[i].prefix);
}
@@ -1406,6 +1407,7 @@ void SafeBrowsingDatabaseNew::LoadWhitelist(
}
std::vector<SBFullHash> new_whitelist;
+ new_whitelist.reserve(full_hashes.size());
for (std::vector<SBAddFullHash>::const_iterator it = full_hashes.begin();
it != full_hashes.end(); ++it) {
new_whitelist.push_back(it->full_hash);
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698