Allow chrome trace to be collected when atrace is enabled.

Previously we chrome trace and atrace is exclusive. Sometimes this is
inconvenient.

BUG=244501

Review URL: https://chromiumcodereview.appspot.com/15892014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202949 0039d316-1c4b-4281-b951-d872f2087c98
parent 61fce6b4
......@@ -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_;
......
......@@ -463,6 +463,8 @@ class BASE_EXPORT TraceLog {
void EnableIncludedCategoryGroup(int category_index);
static void SetCategoryGroupEnabled(int category_index, bool enabled);
static bool IsCategoryGroupEnabled(
const unsigned char* category_group_enabled);
// The pointer returned from GetCategoryGroupEnabledInternal() points to a
// value with zero or more of the following bits. Used in this class only.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment