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

Unified Diff: base/debug/trace_event_impl.cc

Issue 374043002: Fix tracing 64-bit to 32-bit truncations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/debug/trace_event_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.cc
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index 8bcbe0e45ef55f79ea0c0c81596fdca402afd15f..3c12453e54cb60dff35a837df9bd3c1a8781a7a3 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -1209,7 +1209,7 @@ const char* TraceLog::GetCategoryGroupName(
return g_category_groups[category_index];
}
-void TraceLog::UpdateCategoryGroupEnabledFlag(int category_index) {
+void TraceLog::UpdateCategoryGroupEnabledFlag(size_t category_index) {
unsigned char enabled_flag = 0;
const char* category_group = g_category_groups[category_index];
if (mode_ == RECORDING_MODE &&
@@ -1225,8 +1225,8 @@ void TraceLog::UpdateCategoryGroupEnabledFlag(int category_index) {
}
void TraceLog::UpdateCategoryGroupEnabledFlags() {
- int category_index = base::subtle::NoBarrier_Load(&g_category_index);
- for (int i = 0; i < category_index; i++)
+ size_t category_index = base::subtle::NoBarrier_Load(&g_category_index);
+ for (size_t i = 0; i < category_index; i++)
UpdateCategoryGroupEnabledFlag(i);
}
@@ -1264,10 +1264,10 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
DCHECK(!strchr(category_group, '"')) <<
"Category groups may not contain double quote";
// The g_category_groups is append only, avoid using a lock for the fast path.
- int current_category_index = base::subtle::Acquire_Load(&g_category_index);
+ size_t current_category_index = base::subtle::Acquire_Load(&g_category_index);
// Search for pre-existing category group.
- for (int i = 0; i < current_category_index; ++i) {
+ for (size_t i = 0; i < current_category_index; ++i) {
if (strcmp(g_category_groups[i], category_group) == 0) {
return &g_category_group_enabled[i];
}
@@ -1279,8 +1279,8 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
// Only hold to lock when actually appending a new category, and
// check the categories groups again.
AutoLock lock(lock_);
- int category_index = base::subtle::Acquire_Load(&g_category_index);
- for (int i = 0; i < category_index; ++i) {
+ size_t category_index = base::subtle::Acquire_Load(&g_category_index);
+ for (size_t i = 0; i < category_index; ++i) {
if (strcmp(g_category_groups[i], category_group) == 0) {
return &g_category_group_enabled[i];
}
@@ -1316,8 +1316,8 @@ void TraceLog::GetKnownCategoryGroups(
AutoLock lock(lock_);
category_groups->push_back(
g_category_groups[g_category_trace_event_overhead]);
- int category_index = base::subtle::NoBarrier_Load(&g_category_index);
- for (int i = g_num_builtin_categories; i < category_index; i++)
+ size_t category_index = base::subtle::NoBarrier_Load(&g_category_index);
+ for (size_t i = g_num_builtin_categories; i < category_index; i++)
category_groups->push_back(g_category_groups[i]);
}
« no previous file with comments | « base/debug/trace_event_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698