| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 EventRegisterChrome(); | 172 EventRegisterChrome(); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 TraceEventETWExport::~TraceEventETWExport() { | 176 TraceEventETWExport::~TraceEventETWExport() { |
| 177 EventUnregisterChrome(); | 177 EventUnregisterChrome(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 TraceEventETWExport* TraceEventETWExport::GetInstance() { | 181 TraceEventETWExport* TraceEventETWExport::GetInstance() { |
| 182 return Singleton<TraceEventETWExport, | 182 return base::Singleton<TraceEventETWExport, base::StaticMemorySingletonTraits< |
| 183 StaticMemorySingletonTraits<TraceEventETWExport>>::get(); | 183 TraceEventETWExport>>::get(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // static | 186 // static |
| 187 void TraceEventETWExport::EnableETWExport() { | 187 void TraceEventETWExport::EnableETWExport() { |
| 188 auto* instance = GetInstance(); | 188 auto* instance = GetInstance(); |
| 189 if (instance && !instance->etw_export_enabled_) { | 189 if (instance && !instance->etw_export_enabled_) { |
| 190 instance->etw_export_enabled_ = true; | 190 instance->etw_export_enabled_ = true; |
| 191 // Sync the enabled categories with ETW by calling UpdateEnabledCategories() | 191 // Sync the enabled categories with ETW by calling UpdateEnabledCategories() |
| 192 // that checks the keyword. Then create a thread that will call that same | 192 // that checks the keyword. Then create a thread that will call that same |
| 193 // function periodically, to make sure we stay in sync. | 193 // function periodically, to make sure we stay in sync. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // static | 421 // static |
| 422 void TraceEventETWExport::UpdateETWKeyword() { | 422 void TraceEventETWExport::UpdateETWKeyword() { |
| 423 if (!IsETWExportEnabled()) | 423 if (!IsETWExportEnabled()) |
| 424 return; | 424 return; |
| 425 auto* instance = GetInstance(); | 425 auto* instance = GetInstance(); |
| 426 DCHECK(instance); | 426 DCHECK(instance); |
| 427 instance->UpdateEnabledCategories(); | 427 instance->UpdateEnabledCategories(); |
| 428 } | 428 } |
| 429 } // namespace trace_event | 429 } // namespace trace_event |
| 430 } // namespace base | 430 } // namespace base |
| OLD | NEW |