| 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 739 |
| 740 // Can't enable tracing when Flush() is in progress. | 740 // Can't enable tracing when Flush() is in progress. |
| 741 DCHECK(!flush_task_runner_); | 741 DCHECK(!flush_task_runner_); |
| 742 | 742 |
| 743 InternalTraceOptions new_options = | 743 InternalTraceOptions new_options = |
| 744 GetInternalOptionsFromTraceConfig(trace_config); | 744 GetInternalOptionsFromTraceConfig(trace_config); |
| 745 | 745 |
| 746 InternalTraceOptions old_options = trace_options(); | 746 InternalTraceOptions old_options = trace_options(); |
| 747 | 747 |
| 748 if (dispatching_to_observer_list_) { | 748 if (dispatching_to_observer_list_) { |
| 749 NOTREACHED() | 749 // TODO(ssid): Change to NOTREACHED after fixing crbug.com/625170. |
| 750 DLOG(ERROR) |
| 750 << "Cannot manipulate TraceLog::Enabled state from an observer."; | 751 << "Cannot manipulate TraceLog::Enabled state from an observer."; |
| 751 return; | 752 return; |
| 752 } | 753 } |
| 753 | 754 |
| 754 // Clear all filters from previous tracing session. These filters are not | 755 // Clear all filters from previous tracing session. These filters are not |
| 755 // cleared at the end of tracing because some threads which hit trace event | 756 // cleared at the end of tracing because some threads which hit trace event |
| 756 // when disabling, could try to use the filters. | 757 // when disabling, could try to use the filters. |
| 757 if (!enabled_modes_) | 758 if (!enabled_modes_) |
| 758 g_category_group_filters.Get().clear(); | 759 g_category_group_filters.Get().clear(); |
| 759 | 760 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 SetDisabledWhileLocked(modes_to_disable); | 869 SetDisabledWhileLocked(modes_to_disable); |
| 869 } | 870 } |
| 870 | 871 |
| 871 void TraceLog::SetDisabledWhileLocked(uint8_t modes_to_disable) { | 872 void TraceLog::SetDisabledWhileLocked(uint8_t modes_to_disable) { |
| 872 lock_.AssertAcquired(); | 873 lock_.AssertAcquired(); |
| 873 | 874 |
| 874 if (!(enabled_modes_ & modes_to_disable)) | 875 if (!(enabled_modes_ & modes_to_disable)) |
| 875 return; | 876 return; |
| 876 | 877 |
| 877 if (dispatching_to_observer_list_) { | 878 if (dispatching_to_observer_list_) { |
| 878 NOTREACHED() | 879 // TODO(ssid): Change to NOTREACHED after fixing crbug.com/625170. |
| 880 DLOG(ERROR) |
| 879 << "Cannot manipulate TraceLog::Enabled state from an observer."; | 881 << "Cannot manipulate TraceLog::Enabled state from an observer."; |
| 880 return; | 882 return; |
| 881 } | 883 } |
| 882 | 884 |
| 883 bool is_recording_mode_disabled = | 885 bool is_recording_mode_disabled = |
| 884 (enabled_modes_ & RECORDING_MODE) && (modes_to_disable & RECORDING_MODE); | 886 (enabled_modes_ & RECORDING_MODE) && (modes_to_disable & RECORDING_MODE); |
| 885 enabled_modes_ &= ~modes_to_disable; | 887 enabled_modes_ &= ~modes_to_disable; |
| 886 | 888 |
| 887 if (modes_to_disable & FILTERING_MODE) | 889 if (modes_to_disable & FILTERING_MODE) |
| 888 enabled_event_filters_.clear(); | 890 enabled_event_filters_.clear(); |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 } | 1973 } |
| 1972 | 1974 |
| 1973 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1975 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1974 if (*category_group_enabled_) { | 1976 if (*category_group_enabled_) { |
| 1975 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1977 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1976 event_handle_); | 1978 event_handle_); |
| 1977 } | 1979 } |
| 1978 } | 1980 } |
| 1979 | 1981 |
| 1980 } // namespace trace_event_internal | 1982 } // namespace trace_event_internal |
| OLD | NEW |