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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add \n Created 5 years, 3 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_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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698