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

Unified Diff: base/debug/trace_event_impl.cc

Issue 12302036: Add a mode flag to the tracing framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: base/debug/trace_event_impl.cc
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index cbcf54b81c6aac08b08d5f71fb6796f6869b84de..569a0132effd0f1bd0637b1422976a7e906486b6 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -351,7 +351,8 @@ TraceLog* TraceLog::GetInstance() {
TraceLog::TraceLog()
: enable_count_(0),
dispatching_to_observer_list_(false),
- watch_category_(NULL) {
+ watch_category_(NULL),
+ trace_mode_(UNTIL_FULL) {
// Trace is enabled or disabled on one thread while other threads are
// accessing the enabled flag. We don't care whether edge-case events are
// traced or not, so we allow races on the enabled flag to keep the trace
@@ -478,10 +479,15 @@ void TraceLog::GetKnownCategories(std::vector<std::string>* categories) {
}
void TraceLog::SetEnabled(const std::vector<std::string>& included_categories,
- const std::vector<std::string>& excluded_categories) {
+ const std::vector<std::string>& excluded_categories,
+ TraceMode mode) {
AutoLock lock(lock_);
if (enable_count_++ > 0) {
+ if (mode != trace_mode_) {
+ DLOG(ERROR) << "Attemting to re-enable tracing with a different mode.";
+ }
+
// Tracing is already enabled, so just merge in enabled categories.
// We only expand the set of enabled categories upon nested SetEnable().
if (!included_categories_.empty() && !included_categories.empty()) {
@@ -497,6 +503,7 @@ void TraceLog::SetEnabled(const std::vector<std::string>& included_categories,
}
return;
}
+ trace_mode_ = mode;
if (dispatching_to_observer_list_) {
DLOG(ERROR) <<
@@ -520,7 +527,7 @@ void TraceLog::SetEnabled(const std::vector<std::string>& included_categories,
EnableMatchingCategories(excluded_categories_, 0, CATEGORY_ENABLED);
}
-void TraceLog::SetEnabled(const std::string& categories) {
+void TraceLog::SetEnabled(const std::string& categories, TraceMode mode) {
std::vector<std::string> included, excluded;
// Tokenize list of categories, delimited by ','.
StringTokenizer tokens(categories, ",");
@@ -538,7 +545,7 @@ void TraceLog::SetEnabled(const std::string& categories) {
else
excluded.push_back(category);
}
- SetEnabled(included, excluded);
+ SetEnabled(included, excluded, mode);
}
void TraceLog::GetEnabledTraceCategories(
@@ -577,9 +584,9 @@ void TraceLog::SetDisabled() {
AddThreadNameMetadataEvents();
}
-void TraceLog::SetEnabled(bool enabled) {
+void TraceLog::SetEnabled(bool enabled, TraceMode mode) {
if (enabled)
- SetEnabled(std::vector<std::string>(), std::vector<std::string>());
+ SetEnabled(std::vector<std::string>(), std::vector<std::string>(), mode);
else
SetDisabled();
}

Powered by Google App Engine
This is Rietveld 408576698