summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 14:21:16 +0000
committerwfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 14:21:16 +0000
commit1f17c249692da535e2fa7a5a81fd85044586458f (patch)
tree116fe4b399652c6aff5873336b541b0736b0ed15
parent6c0c9736ddcd8a677414f64a270b5a48a9bc5705 (diff)
downloadchromium_src-1f17c249692da535e2fa7a5a81fd85044586458f.zip
chromium_src-1f17c249692da535e2fa7a5a81fd85044586458f.tar.gz
chromium_src-1f17c249692da535e2fa7a5a81fd85044586458f.tar.bz2
Fix tracing 64-bit to 32-bit truncations.
BUG=392035 Review URL: https://codereview.chromium.org/374043002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281745 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/debug/trace_event.h5
-rw-r--r--base/debug/trace_event_impl.cc18
-rw-r--r--base/debug/trace_event_impl.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index 686bd38..dcb332d 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -1003,7 +1003,7 @@ class TraceID {
public:
explicit DontMangle(const void* id)
: data_(static_cast<unsigned long long>(
- reinterpret_cast<unsigned long>(id))) {}
+ reinterpret_cast<uintptr_t>(id))) {}
explicit DontMangle(unsigned long long id) : data_(id) {}
explicit DontMangle(unsigned long id) : data_(id) {}
explicit DontMangle(unsigned int id) : data_(id) {}
@@ -1045,10 +1045,9 @@ class TraceID {
private:
unsigned long long data_;
};
-
TraceID(const void* id, unsigned char* flags)
: data_(static_cast<unsigned long long>(
- reinterpret_cast<unsigned long>(id))) {
+ reinterpret_cast<uintptr_t>(id))) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index 8bcbe0e..3c12453 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]);
}
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index e5a6dbd..7f65303 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -616,7 +616,7 @@ class BASE_EXPORT TraceLog {
// the category group, or event_callback_ is not null and
// event_callback_category_filter_ matches the category group.
void UpdateCategoryGroupEnabledFlags();
- void UpdateCategoryGroupEnabledFlag(int category_index);
+ void UpdateCategoryGroupEnabledFlag(size_t category_index);
// Configure synthetic delays based on the values set in the current
// category filter.