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

Unified Diff: base/debug/trace_event_impl.cc

Issue 15892014: Allow chrome trace to be collected when atrace is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 | « 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 e8b3083339cb14a72a2e338f2857bbfc8063f9f0..34f26f640e5b5f40327185106dec1c89351b8e75 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -836,14 +836,20 @@ void TraceLog::EnableIncludedCategoryGroup(int category_index) {
}
void TraceLog::SetCategoryGroupEnabled(int category_index, bool is_enabled) {
- g_category_group_enabled[category_index] =
- is_enabled ? TraceLog::CATEGORY_ENABLED : 0;
+ g_category_group_enabled[category_index] = is_enabled ? CATEGORY_ENABLED : 0;
#if defined(OS_ANDROID)
ApplyATraceEnabledFlag(&g_category_group_enabled[category_index]);
#endif
}
+bool TraceLog::IsCategoryGroupEnabled(
+ const unsigned char* category_group_enabled) {
+ // On Android, ATrace and normal trace can be enabled independently.
+ // This function checks if the normal trace is enabled.
+ return *category_group_enabled & CATEGORY_ENABLED;
+}
+
void TraceLog::EnableIncludedCategoryGroups() {
for (int i = 0; i < g_category_index; i++)
EnableIncludedCategoryGroup(i);
@@ -1116,7 +1122,7 @@ void TraceLog::AddTraceEventWithThreadIdAndTimestamp(
do {
AutoLock lock(lock_);
- if (*category_group_enabled != CATEGORY_ENABLED)
+ if (!IsCategoryGroupEnabled(category_group_enabled))
return;
event_callback_copy = event_callback_;
« 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