| 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_event_etw_export_win.h" | 5 #include "base/trace_event/trace_event_etw_export_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 categories_status_[kDisabledOtherEventsGroupName] = false; | 183 categories_status_[kDisabledOtherEventsGroupName] = false; |
| 184 DCHECK_EQ(kNumberOfCategories, categories_status_.size()); | 184 DCHECK_EQ(kNumberOfCategories, categories_status_.size()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 TraceEventETWExport::~TraceEventETWExport() { | 187 TraceEventETWExport::~TraceEventETWExport() { |
| 188 EventUnregisterChrome(); | 188 EventUnregisterChrome(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 // static | 191 // static |
| 192 TraceEventETWExport* TraceEventETWExport::GetInstance() { | 192 TraceEventETWExport* TraceEventETWExport::GetInstance() { |
| 193 return Singleton<TraceEventETWExport, | 193 return base::Singleton<TraceEventETWExport, base::StaticMemorySingletonTraits< |
| 194 StaticMemorySingletonTraits<TraceEventETWExport>>::get(); | 194 TraceEventETWExport>>::get(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // static | 197 // static |
| 198 void TraceEventETWExport::EnableETWExport() { | 198 void TraceEventETWExport::EnableETWExport() { |
| 199 auto* instance = GetInstance(); | 199 auto* instance = GetInstance(); |
| 200 if (instance && !instance->etw_export_enabled_) { | 200 if (instance && !instance->etw_export_enabled_) { |
| 201 instance->etw_export_enabled_ = true; | 201 instance->etw_export_enabled_ = true; |
| 202 // Sync the enabled categories with ETW by calling UpdateEnabledCategories() | 202 // Sync the enabled categories with ETW by calling UpdateEnabledCategories() |
| 203 // that checks the keyword. Then create a thread that will call that same | 203 // that checks the keyword. Then create a thread that will call that same |
| 204 // function periodically, to make sure we stay in sync. | 204 // function periodically, to make sure we stay in sync. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // static | 435 // static |
| 436 void TraceEventETWExport::UpdateETWKeyword() { | 436 void TraceEventETWExport::UpdateETWKeyword() { |
| 437 if (!IsETWExportEnabled()) | 437 if (!IsETWExportEnabled()) |
| 438 return; | 438 return; |
| 439 auto* instance = GetInstance(); | 439 auto* instance = GetInstance(); |
| 440 DCHECK(instance); | 440 DCHECK(instance); |
| 441 instance->UpdateEnabledCategories(); | 441 instance->UpdateEnabledCategories(); |
| 442 } | 442 } |
| 443 } // namespace trace_event | 443 } // namespace trace_event |
| 444 } // namespace base | 444 } // namespace base |
| OLD | NEW |