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

Side by Side Diff: base/trace_event/trace_log.cc

Issue 2820433005: memory-infra: Start disentangling tracing from memory-infra (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/trace_event/trace_log.h" 5 #include "base/trace_event/trace_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 observer->OnTraceLogDisabled(); 748 observer->OnTraceLogDisabled();
749 for (const auto& it : observer_map) { 749 for (const auto& it : observer_map) {
750 it.second.task_runner->PostTask( 750 it.second.task_runner->PostTask(
751 FROM_HERE, Bind(&AsyncEnabledStateObserver::OnTraceLogDisabled, 751 FROM_HERE, Bind(&AsyncEnabledStateObserver::OnTraceLogDisabled,
752 it.second.observer)); 752 it.second.observer));
753 } 753 }
754 } 754 }
755 dispatching_to_observer_list_ = false; 755 dispatching_to_observer_list_ = false;
756 } 756 }
757 757
758 bool TraceLog::IsEnabled() {
759 return enabled_modes_ & RECORDING_MODE;
760 }
hjd 2017/04/13 14:16:59 Can't be inline if IsEnabled is virtual.
761
758 int TraceLog::GetNumTracesRecorded() { 762 int TraceLog::GetNumTracesRecorded() {
759 AutoLock lock(lock_); 763 AutoLock lock(lock_);
760 if (!IsEnabled()) 764 if (!IsEnabled())
761 return -1; 765 return -1;
762 return num_traces_recorded_; 766 return num_traces_recorded_;
763 } 767 }
764 768
765 void TraceLog::AddEnabledStateObserver(EnabledStateObserver* listener) { 769 void TraceLog::AddEnabledStateObserver(EnabledStateObserver* listener) {
766 AutoLock lock(lock_); 770 AutoLock lock(lock_);
767 enabled_state_observer_list_.push_back(listener); 771 enabled_state_observer_list_.push_back(listener);
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 } 1737 }
1734 1738
1735 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1739 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1736 if (*category_group_enabled_) { 1740 if (*category_group_enabled_) {
1737 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1741 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1738 event_handle_); 1742 event_handle_);
1739 } 1743 }
1740 } 1744 }
1741 1745
1742 } // namespace trace_event_internal 1746 } // namespace trace_event_internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698