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

Unified Diff: src/profile-generator.cc

Issue 2418001: Fix AddBlock invocations in CpuProfilesCollection. (Closed)
Patch Set: Created 10 years, 7 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 | « src/platform-linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index ad8867ced1c0b8646de9d13bb839585f92fff94d..105c1a8435c3fbf4280b09ed2144318ee50f215e 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -572,7 +572,8 @@ int CpuProfilesCollection::TokenToIndex(int security_token_id) {
List<CpuProfile*>* CpuProfilesCollection::GetProfilesList(
int security_token_id) {
const int index = TokenToIndex(security_token_id);
- profiles_by_token_.AddBlock(NULL, profiles_by_token_.length() - index + 1);
+ const int lists_to_add = index - profiles_by_token_.length() + 1;
+ if (lists_to_add > 0) profiles_by_token_.AddBlock(NULL, lists_to_add);
List<CpuProfile*>* unabridged_list =
profiles_by_token_[TokenToIndex(CodeEntry::kNoSecurityToken)];
const int current_count = unabridged_list->length();
@@ -580,7 +581,8 @@ List<CpuProfile*>* CpuProfilesCollection::GetProfilesList(
profiles_by_token_[index] = new List<CpuProfile*>(current_count);
}
List<CpuProfile*>* list = profiles_by_token_[index];
- list->AddBlock(NULL, current_count - list->length());
+ const int profiles_to_add = current_count - list->length();
+ if (profiles_to_add > 0) list->AddBlock(NULL, profiles_to_add);
return list;
}
« no previous file with comments | « src/platform-linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698