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

Unified Diff: base/debug/trace_event_impl.cc

Issue 15774010: Add TRACE_EVENT_IS_NEW_TRACE as a way to snapshot objects at start of recording (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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') | base/debug/trace_event_unittest.cc » ('j') | 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 34f26f640e5b5f40327185106dec1c89351b8e75..6e3516e2c2bface6552466a6828ff201a8a97bee 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -773,6 +773,7 @@ TraceLog::Options TraceLog::TraceOptionsFromString(const std::string& options) {
TraceLog::TraceLog()
: enable_count_(0),
+ num_traces_recorded_(0),
logged_events_(NULL),
dispatching_to_observer_list_(false),
watch_category_(NULL),
@@ -933,6 +934,8 @@ void TraceLog::SetEnabled(const CategoryFilter& category_filter,
return;
}
+ num_traces_recorded_++;
+
dispatching_to_observer_list_ = true;
FOR_EACH_OBSERVER(EnabledStateChangedObserver, enabled_state_observer_list_,
OnTraceLogWillEnable());
@@ -1007,6 +1010,13 @@ void TraceLog::SetDisabled() {
AddThreadNameMetadataEvents();
}
+int TraceLog::GetNumTracesRecorded() {
+ AutoLock lock(lock_);
+ if (enable_count_ == 0)
+ return -1;
+ return num_traces_recorded_;
+}
+
void TraceLog::AddEnabledStateObserver(EnabledStateChangedObserver* listener) {
enabled_state_observer_list_.AddObserver(listener);
}
@@ -1517,4 +1527,3 @@ ScopedTrace::~ScopedTrace() {
}
} // namespace trace_event_internal
-
« no previous file with comments | « base/debug/trace_event_impl.h ('k') | base/debug/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698