Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 | 827 |
| 828 if (!IsEnabled()) | 828 if (!IsEnabled()) |
| 829 return; | 829 return; |
| 830 | 830 |
| 831 if (dispatching_to_observer_list_) { | 831 if (dispatching_to_observer_list_) { |
| 832 DLOG(ERROR) | 832 DLOG(ERROR) |
| 833 << "Cannot manipulate TraceLog::Enabled state from an observer."; | 833 << "Cannot manipulate TraceLog::Enabled state from an observer."; |
| 834 return; | 834 return; |
| 835 } | 835 } |
| 836 | 836 |
| 837 mode_ = DISABLED; | 837 //mode_ = DISABLED; |
| 838 | 838 |
| 839 if (sampling_thread_) { | 839 if (sampling_thread_) { |
| 840 // Stop the sampling thread. | 840 // Stop the sampling thread. |
| 841 sampling_thread_->Stop(); | 841 sampling_thread_->Stop(); |
| 842 lock_.Release(); | 842 lock_.Release(); |
| 843 PlatformThread::Join(sampling_thread_handle_); | 843 PlatformThread::Join(sampling_thread_handle_); |
| 844 lock_.Acquire(); | 844 lock_.Acquire(); |
| 845 sampling_thread_handle_ = PlatformThreadHandle(); | 845 sampling_thread_handle_ = PlatformThreadHandle(); |
| 846 sampling_thread_.reset(); | 846 sampling_thread_.reset(); |
| 847 } | 847 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 860 enabled_state_observer_list_; | 860 enabled_state_observer_list_; |
| 861 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map = | 861 std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map = |
| 862 async_observers_; | 862 async_observers_; |
| 863 | 863 |
| 864 { | 864 { |
| 865 // Dispatch to observers outside the lock in case the observer triggers a | 865 // Dispatch to observers outside the lock in case the observer triggers a |
| 866 // trace event. | 866 // trace event. |
| 867 AutoUnlock unlock(lock_); | 867 AutoUnlock unlock(lock_); |
| 868 for (EnabledStateObserver* observer : observer_list) | 868 for (EnabledStateObserver* observer : observer_list) |
| 869 observer->OnTraceLogDisabled(); | 869 observer->OnTraceLogDisabled(); |
| 870 mode_ = DISABLED; | |
|
Primiano Tucci (use gerrit)
2016/09/14 09:38:54
???
alexandermont
2016/09/14 20:14:57
Reverted this change. Originally this was there be
| |
| 870 for (const auto& it : observer_map) { | 871 for (const auto& it : observer_map) { |
| 871 it.second.task_runner->PostTask( | 872 it.second.task_runner->PostTask( |
| 872 FROM_HERE, Bind(&AsyncEnabledStateObserver::OnTraceLogDisabled, | 873 FROM_HERE, Bind(&AsyncEnabledStateObserver::OnTraceLogDisabled, |
| 873 it.second.observer)); | 874 it.second.observer)); |
| 874 } | 875 } |
| 875 } | 876 } |
| 876 dispatching_to_observer_list_ = false; | 877 dispatching_to_observer_list_ = false; |
| 877 } | 878 } |
| 878 | 879 |
| 879 int TraceLog::GetNumTracesRecorded() { | 880 int TraceLog::GetNumTracesRecorded() { |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1923 } | 1924 } |
| 1924 | 1925 |
| 1925 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1926 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1926 if (*category_group_enabled_) { | 1927 if (*category_group_enabled_) { |
| 1927 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1928 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1928 event_handle_); | 1929 event_handle_); |
| 1929 } | 1930 } |
| 1930 } | 1931 } |
| 1931 | 1932 |
| 1932 } // namespace trace_event_internal | 1933 } // namespace trace_event_internal |
| OLD | NEW |