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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « base/debug/trace_event_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return g_category_groups[category_index]; 829 return g_category_groups[category_index];
830 } 830 }
831 831
832 void TraceLog::EnableIncludedCategoryGroup(int category_index) { 832 void TraceLog::EnableIncludedCategoryGroup(int category_index) {
833 bool is_enabled = category_filter_.IsCategoryGroupEnabled( 833 bool is_enabled = category_filter_.IsCategoryGroupEnabled(
834 g_category_groups[category_index]); 834 g_category_groups[category_index]);
835 SetCategoryGroupEnabled(category_index, is_enabled); 835 SetCategoryGroupEnabled(category_index, is_enabled);
836 } 836 }
837 837
838 void TraceLog::SetCategoryGroupEnabled(int category_index, bool is_enabled) { 838 void TraceLog::SetCategoryGroupEnabled(int category_index, bool is_enabled) {
839 g_category_group_enabled[category_index] = 839 g_category_group_enabled[category_index] = is_enabled ? CATEGORY_ENABLED : 0;
840 is_enabled ? TraceLog::CATEGORY_ENABLED : 0;
841 840
842 #if defined(OS_ANDROID) 841 #if defined(OS_ANDROID)
843 ApplyATraceEnabledFlag(&g_category_group_enabled[category_index]); 842 ApplyATraceEnabledFlag(&g_category_group_enabled[category_index]);
844 #endif 843 #endif
845 } 844 }
846 845
846 bool TraceLog::IsCategoryGroupEnabled(
847 const unsigned char* category_group_enabled) {
848 // On Android, ATrace and normal trace can be enabled independently.
849 // This function checks if the normal trace is enabled.
850 return *category_group_enabled & CATEGORY_ENABLED;
851 }
852
847 void TraceLog::EnableIncludedCategoryGroups() { 853 void TraceLog::EnableIncludedCategoryGroups() {
848 for (int i = 0; i < g_category_index; i++) 854 for (int i = 0; i < g_category_index; i++)
849 EnableIncludedCategoryGroup(i); 855 EnableIncludedCategoryGroup(i);
850 } 856 }
851 857
852 const unsigned char* TraceLog::GetCategoryGroupEnabledInternal( 858 const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
853 const char* category_group) { 859 const char* category_group) {
854 DCHECK(!strchr(category_group, '"')) << 860 DCHECK(!strchr(category_group, '"')) <<
855 "Category groups may not contain double quote"; 861 "Category groups may not contain double quote";
856 AutoLock lock(lock_); 862 AutoLock lock(lock_);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 flags); 1115 flags);
1110 #endif 1116 #endif
1111 1117
1112 TimeTicks now = timestamp - time_offset_; 1118 TimeTicks now = timestamp - time_offset_;
1113 EventCallback event_callback_copy; 1119 EventCallback event_callback_copy;
1114 1120
1115 NotificationHelper notifier(this); 1121 NotificationHelper notifier(this);
1116 1122
1117 do { 1123 do {
1118 AutoLock lock(lock_); 1124 AutoLock lock(lock_);
1119 if (*category_group_enabled != CATEGORY_ENABLED) 1125 if (!IsCategoryGroupEnabled(category_group_enabled))
1120 return; 1126 return;
1121 1127
1122 event_callback_copy = event_callback_; 1128 event_callback_copy = event_callback_;
1123 if (logged_events_->IsFull()) 1129 if (logged_events_->IsFull())
1124 break; 1130 break;
1125 1131
1126 const char* new_name = ThreadIdNameManager::GetInstance()-> 1132 const char* new_name = ThreadIdNameManager::GetInstance()->
1127 GetName(thread_id); 1133 GetName(thread_id);
1128 // Check if the thread name has been set or changed since the previous 1134 // Check if the thread name has been set or changed since the previous
1129 // call (if any), but don't bother if the new name is empty. Note this will 1135 // call (if any), but don't bother if the new name is empty. Note this will
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 NULL, // arg_names 1511 NULL, // arg_names
1506 NULL, // arg_types 1512 NULL, // arg_types
1507 NULL, // arg_values 1513 NULL, // arg_values
1508 NULL, // convertable values 1514 NULL, // convertable values
1509 TRACE_EVENT_FLAG_NONE); // flags 1515 TRACE_EVENT_FLAG_NONE); // flags
1510 } 1516 }
1511 } 1517 }
1512 1518
1513 } // namespace trace_event_internal 1519 } // namespace trace_event_internal
1514 1520
OLDNEW
« 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