summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorolli.raula <olli.raula@intel.com>2015-09-10 04:14:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-10 11:15:10 +0000
commit36aa8be4eb53b3ea75b84a9646e0204725f3bc43 (patch)
tree74da8174db2a6edd8d55cf141ec1976b3b37365d /base
parent68fc3715f76e3da9131b035ddd9606dfee6180bd (diff)
downloadchromium_src-36aa8be4eb53b3ea75b84a9646e0204725f3bc43.zip
chromium_src-36aa8be4eb53b3ea75b84a9646e0204725f3bc43.tar.gz
chromium_src-36aa8be4eb53b3ea75b84a9646e0204725f3bc43.tar.bz2
Move Singleton and related structs to namespace base
Public APIs from base should live inside base:: so moved Singleton class and structs to base{} and fixed consumers. also fixed: ** Presubmit ERRORS ** Found Singleton<T> in the following header files. Please move them to an appropriate source file so that the template gets instantiated in a single compilation unit. chrome/browser/plugins/plugin_finder.h \ chromecast/media/base/media_message_loop.h \ content/browser/media/android/media_drm_credential_manager.h Presubmit warnings: src/chrome/browser/extensions/warning_badge_service_factory.h:5: #ifndef header guard has wrong style, please use: CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_ [build/header_guard] [5] src/chrome/browser/extensions/warning_badge_service_factory.h:39: #endif line should be "#endif // CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_" [build/header_guard] [5] TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1308823002 Cr-Commit-Position: refs/heads/master@{#348136}
Diffstat (limited to 'base')
-rw-r--r--base/linux_util.cc8
-rw-r--r--base/logging_win.cc4
-rw-r--r--base/logging_win.h4
-rw-r--r--base/memory/singleton.h54
-rw-r--r--base/memory/singleton_unittest.cc11
-rw-r--r--base/test/test_support_android.cc6
-rw-r--r--base/threading/thread_id_name_manager.h5
-rw-r--r--base/trace_event/trace_event_etw_export_win.cc11
-rw-r--r--base/trace_event/trace_event_etw_export_win.h6
-rw-r--r--base/trace_event/trace_event_synthetic_delay.cc43
-rw-r--r--base/trace_event/trace_event_win.h4
-rw-r--r--base/trace_event/trace_log.cc16
-rw-r--r--base/trace_event/trace_log.h5
13 files changed, 91 insertions, 86 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc
index d6cd504..d94588f 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -37,7 +37,7 @@ class LinuxDistroHelper {
public:
// Retrieves the Singleton.
static LinuxDistroHelper* GetInstance() {
- return Singleton<LinuxDistroHelper>::get();
+ return base::Singleton<LinuxDistroHelper>::get();
}
// The simple state machine goes from:
@@ -106,7 +106,7 @@ std::string GetLinuxDistro() {
argv.push_back("lsb_release");
argv.push_back("-d");
std::string output;
- base::GetAppOutput(CommandLine(argv), &output);
+ GetAppOutput(CommandLine(argv), &output);
if (output.length() > 0) {
// lsb_release -d should return: Description:<tab>Distro Info
const char field[] = "Description:\t";
@@ -124,8 +124,8 @@ std::string GetLinuxDistro() {
void SetLinuxDistro(const std::string& distro) {
std::string trimmed_distro;
- base::TrimWhitespaceASCII(distro, base::TRIM_ALL, &trimmed_distro);
- base::strlcpy(g_linux_distro, trimmed_distro.c_str(), kDistroSize);
+ TrimWhitespaceASCII(distro, TRIM_ALL, &trimmed_distro);
+ strlcpy(g_linux_distro, trimmed_distro.c_str(), kDistroSize);
}
pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
diff --git a/base/logging_win.cc b/base/logging_win.cc
index 53cc37c..319ae8a 100644
--- a/base/logging_win.cc
+++ b/base/logging_win.cc
@@ -18,8 +18,8 @@ LogEventProvider::LogEventProvider() : old_log_level_(LOG_NONE) {
}
LogEventProvider* LogEventProvider::GetInstance() {
- return Singleton<LogEventProvider,
- StaticMemorySingletonTraits<LogEventProvider> >::get();
+ return base::Singleton<LogEventProvider, base::StaticMemorySingletonTraits<
+ LogEventProvider>>::get();
}
bool LogEventProvider::LogMessage(logging::LogSeverity severity,
diff --git a/base/logging_win.h b/base/logging_win.h
index aa48e22..de34a64 100644
--- a/base/logging_win.h
+++ b/base/logging_win.h
@@ -12,8 +12,10 @@
#include "base/win/event_trace_provider.h"
#include "base/logging.h"
+namespace base {
template <typename Type>
struct StaticMemorySingletonTraits;
+} // namespace base
namespace logging {
@@ -71,7 +73,7 @@ class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider {
// restored in OnEventsDisabled.
logging::LogSeverity old_log_level_;
- friend struct StaticMemorySingletonTraits<LogEventProvider>;
+ friend struct base::StaticMemorySingletonTraits<LogEventProvider>;
DISALLOW_COPY_AND_ASSIGN(LogEventProvider);
};
diff --git a/base/memory/singleton.h b/base/memory/singleton.h
index e50bdc0..7319699 100644
--- a/base/memory/singleton.h
+++ b/base/memory/singleton.h
@@ -36,10 +36,10 @@ static const subtle::AtomicWord kBeingCreatedMarker = 1;
// we can implement the more complicated pieces out of line in the .cc file.
BASE_EXPORT subtle::AtomicWord WaitForInstance(subtle::AtomicWord* instance);
+class DeleteTraceLogForTesting;
+
} // namespace internal
-} // namespace base
-// TODO(joth): Move more of this file into namespace base
// Default traits for Singleton<Type>. Calls operator new and operator delete on
// the object. Registers automatic deletion at process exit.
@@ -110,7 +110,7 @@ struct StaticMemorySingletonTraits {
// this is traits for returning NULL.
static Type* New() {
// Only constructs once and returns pointer; otherwise returns NULL.
- if (base::subtle::NoBarrier_AtomicExchange(&dead_, 1))
+ if (subtle::NoBarrier_AtomicExchange(&dead_, 1))
return NULL;
return new(buffer_.void_data()) Type();
@@ -125,20 +125,19 @@ struct StaticMemorySingletonTraits {
static const bool kAllowedToAccessOnNonjoinableThread = true;
// Exposed for unittesting.
- static void Resurrect() {
- base::subtle::NoBarrier_Store(&dead_, 0);
- }
+ static void Resurrect() { subtle::NoBarrier_Store(&dead_, 0); }
private:
- static base::AlignedMemory<sizeof(Type), ALIGNOF(Type)> buffer_;
+ static AlignedMemory<sizeof(Type), ALIGNOF(Type)> buffer_;
// Signal the object was already deleted, so it is not revived.
- static base::subtle::Atomic32 dead_;
+ static subtle::Atomic32 dead_;
};
-template <typename Type> base::AlignedMemory<sizeof(Type), ALIGNOF(Type)>
+template <typename Type>
+AlignedMemory<sizeof(Type), ALIGNOF(Type)>
StaticMemorySingletonTraits<Type>::buffer_;
-template <typename Type> base::subtle::Atomic32
- StaticMemorySingletonTraits<Type>::dead_ = 0;
+template <typename Type>
+subtle::Atomic32 StaticMemorySingletonTraits<Type>::dead_ = 0;
// The Singleton<Type, Traits, DifferentiatingType> class manages a single
// instance of Type which will be created on first use and will be destroyed at
@@ -190,7 +189,7 @@ template <typename Type> base::subtle::Atomic32
// RAE = kRegisterAtExit
//
// On every platform, if Traits::RAE is true, the singleton will be destroyed at
-// process exit. More precisely it uses base::AtExitManager which requires an
+// process exit. More precisely it uses AtExitManager which requires an
// object of this type to be instantiated. AtExitManager mimics the semantics
// of atexit() such as LIFO order but under Windows is safer to call. For more
// information see at_exit.h.
@@ -209,6 +208,7 @@ template <typename Type> base::subtle::Atomic32
// (b) Your factory function must never throw an exception. This class is not
// exception-safe.
//
+
template <typename Type,
typename Traits = DefaultSingletonTraits<Type>,
typename DifferentiatingType = Type>
@@ -219,7 +219,7 @@ class Singleton {
friend Type* Type::GetInstance();
// Allow TraceLog tests to test tracing after OnExit.
- friend class DeleteTraceLogForTesting;
+ friend class internal::DeleteTraceLogForTesting;
// This class is safe to be constructed and copy-constructed since it has no
// member.
@@ -229,36 +229,36 @@ class Singleton {
#ifndef NDEBUG
// Avoid making TLS lookup on release builds.
if (!Traits::kAllowedToAccessOnNonjoinableThread)
- base::ThreadRestrictions::AssertSingletonAllowed();
+ ThreadRestrictions::AssertSingletonAllowed();
#endif
// The load has acquire memory ordering as the thread which reads the
// instance_ pointer must acquire visibility over the singleton data.
- base::subtle::AtomicWord value = base::subtle::Acquire_Load(&instance_);
- if (value != 0 && value != base::internal::kBeingCreatedMarker) {
+ subtle::AtomicWord value = subtle::Acquire_Load(&instance_);
+ if (value != 0 && value != internal::kBeingCreatedMarker) {
return reinterpret_cast<Type*>(value);
}
// Object isn't created yet, maybe we will get to create it, let's try...
- if (base::subtle::Acquire_CompareAndSwap(
- &instance_, 0, base::internal::kBeingCreatedMarker) == 0) {
+ if (subtle::Acquire_CompareAndSwap(&instance_, 0,
+ internal::kBeingCreatedMarker) == 0) {
// instance_ was NULL and is now kBeingCreatedMarker. Only one thread
// will ever get here. Threads might be spinning on us, and they will
// stop right after we do this store.
Type* newval = Traits::New();
// Releases the visibility over instance_ to the readers.
- base::subtle::Release_Store(
- &instance_, reinterpret_cast<base::subtle::AtomicWord>(newval));
+ subtle::Release_Store(&instance_,
+ reinterpret_cast<subtle::AtomicWord>(newval));
if (newval != NULL && Traits::kRegisterAtExit)
- base::AtExitManager::RegisterCallback(OnExit, NULL);
+ AtExitManager::RegisterCallback(OnExit, NULL);
return newval;
}
// We hit a race. Wait for the other thread to complete it.
- value = base::internal::WaitForInstance(&instance_);
+ value = internal::WaitForInstance(&instance_);
return reinterpret_cast<Type*>(value);
}
@@ -269,15 +269,15 @@ class Singleton {
static void OnExit(void* /*unused*/) {
// AtExit should only ever be register after the singleton instance was
// created. We should only ever get here with a valid instance_ pointer.
- Traits::Delete(
- reinterpret_cast<Type*>(base::subtle::NoBarrier_Load(&instance_)));
+ Traits::Delete(reinterpret_cast<Type*>(subtle::NoBarrier_Load(&instance_)));
instance_ = 0;
}
- static base::subtle::AtomicWord instance_;
+ static subtle::AtomicWord instance_;
};
template <typename Type, typename Traits, typename DifferentiatingType>
-base::subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>::
- instance_ = 0;
+subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>::instance_ = 0;
+
+} // namespace base
#endif // BASE_MEMORY_SINGLETON_H_
diff --git a/base/memory/singleton_unittest.cc b/base/memory/singleton_unittest.cc
index dbff007..e8788ba 100644
--- a/base/memory/singleton_unittest.cc
+++ b/base/memory/singleton_unittest.cc
@@ -6,6 +6,7 @@
#include "base/memory/singleton.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
namespace {
COMPILE_ASSERT(DefaultSingletonTraits<int>::kRegisterAtExit == true, a);
@@ -115,7 +116,7 @@ class AlignedTestSingleton {
~AlignedTestSingleton() {}
static AlignedTestSingleton* GetInstance() {
return Singleton<AlignedTestSingleton,
- StaticMemorySingletonTraits<AlignedTestSingleton> >::get();
+ StaticMemorySingletonTraits<AlignedTestSingleton>>::get();
}
Type type_;
@@ -147,7 +148,6 @@ CallbackFunc* GetStaticSingleton() {
return &CallbackSingletonWithStaticTrait::GetInstance()->callback_;
}
-} // namespace
class SingletonTest : public testing::Test {
public:
@@ -207,7 +207,7 @@ TEST_F(SingletonTest, Basic) {
CallbackFunc* static_singleton;
{
- base::ShadowingAtExitManager sem;
+ ShadowingAtExitManager sem;
{
singleton_int = SingletonInt();
}
@@ -241,7 +241,7 @@ TEST_F(SingletonTest, Basic) {
EXPECT_EQ(NULL, GetStaticSingleton());
{
- base::ShadowingAtExitManager sem;
+ ShadowingAtExitManager sem;
// Verifiy that the variables were reset.
{
singleton_int = SingletonInt();
@@ -285,3 +285,6 @@ TEST_F(SingletonTest, Alignment) {
EXPECT_ALIGNED(align128, 128);
EXPECT_ALIGNED(align4096, 4096);
}
+
+} // namespace
+} // namespace base
diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc
index 11a0871..a0f825c8 100644
--- a/base/test/test_support_android.cc
+++ b/base/test/test_support_android.cc
@@ -39,9 +39,7 @@ RunState* g_state = NULL;
// when there are no pending messages.
class Waitable {
public:
- static Waitable* GetInstance() {
- return Singleton<Waitable>::get();
- }
+ static Waitable* GetInstance() { return base::Singleton<Waitable>::get(); }
// Signals that there are more work to do.
void Signal() {
@@ -59,7 +57,7 @@ class Waitable {
}
private:
- friend struct DefaultSingletonTraits<Waitable>;
+ friend struct base::DefaultSingletonTraits<Waitable>;
Waitable()
: waitable_event_(false, false) {
diff --git a/base/threading/thread_id_name_manager.h b/base/threading/thread_id_name_manager.h
index 927d25f..1ba7e13 100644
--- a/base/threading/thread_id_name_manager.h
+++ b/base/threading/thread_id_name_manager.h
@@ -13,10 +13,11 @@
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
-template <typename T> struct DefaultSingletonTraits;
-
namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+
class BASE_EXPORT ThreadIdNameManager {
public:
static ThreadIdNameManager* GetInstance();
diff --git a/base/trace_event/trace_event_etw_export_win.cc b/base/trace_event/trace_event_etw_export_win.cc
index b2276ed..1e05e68 100644
--- a/base/trace_event/trace_event_etw_export_win.cc
+++ b/base/trace_event/trace_event_etw_export_win.cc
@@ -133,19 +133,18 @@ namespace trace_event {
// This object will be created by each process. It's a background (low-priority)
// thread that will monitor the ETW keyword for any changes.
class TraceEventETWExport::ETWKeywordUpdateThread
- : public base::PlatformThread::Delegate {
+ : public PlatformThread::Delegate {
public:
ETWKeywordUpdateThread() {}
~ETWKeywordUpdateThread() override {}
// Implementation of PlatformThread::Delegate:
void ThreadMain() override {
- base::PlatformThread::SetName("ETW Keyword Update Thread");
- base::TimeDelta sleep_time =
- base::TimeDelta::FromMilliseconds(kUpdateTimerDelayMs);
+ PlatformThread::SetName("ETW Keyword Update Thread");
+ TimeDelta sleep_time = TimeDelta::FromMilliseconds(kUpdateTimerDelayMs);
while (1) {
- base::PlatformThread::Sleep(sleep_time);
- base::trace_event::TraceEventETWExport::UpdateETWKeyword();
+ PlatformThread::Sleep(sleep_time);
+ trace_event::TraceEventETWExport::UpdateETWKeyword();
}
}
diff --git a/base/trace_event/trace_event_etw_export_win.h b/base/trace_event/trace_event_etw_export_win.h
index c1eafff..7a1c029 100644
--- a/base/trace_event/trace_event_etw_export_win.h
+++ b/base/trace_event/trace_event_etw_export_win.h
@@ -12,11 +12,11 @@
#include "base/strings/string_piece.h"
#include "base/trace_event/trace_event_impl.h"
-// Fwd.
+namespace base {
+
template <typename Type>
struct StaticMemorySingletonTraits;
-namespace base {
namespace trace_event {
class BASE_EXPORT TraceEventETWExport {
@@ -86,7 +86,7 @@ class BASE_EXPORT TraceEventETWExport {
bool etw_export_enabled_;
// Maps category names to their status (enabled/disabled).
- std::map<base::StringPiece, bool> categories_status_;
+ std::map<StringPiece, bool> categories_status_;
// Local copy of the ETW keyword.
uint64 etw_match_any_keyword_;
diff --git a/base/trace_event/trace_event_synthetic_delay.cc b/base/trace_event/trace_event_synthetic_delay.cc
index bad79cc..cd0c364 100644
--- a/base/trace_event/trace_event_synthetic_delay.cc
+++ b/base/trace_event/trace_event_synthetic_delay.cc
@@ -24,7 +24,7 @@ class TraceEventSyntheticDelayRegistry : public TraceEventSyntheticDelayClock {
void ResetAllDelays();
// TraceEventSyntheticDelayClock implementation.
- base::TimeTicks Now() override;
+ TimeTicks Now() override;
private:
TraceEventSyntheticDelayRegistry();
@@ -34,7 +34,7 @@ class TraceEventSyntheticDelayRegistry : public TraceEventSyntheticDelayClock {
Lock lock_;
TraceEventSyntheticDelay delays_[kMaxSyntheticDelays];
TraceEventSyntheticDelay dummy_delay_;
- base::subtle::Atomic32 delay_count_;
+ subtle::Atomic32 delay_count_;
DISALLOW_COPY_AND_ASSIGN(TraceEventSyntheticDelayRegistry);
};
@@ -57,8 +57,7 @@ void TraceEventSyntheticDelay::Initialize(
clock_ = clock;
}
-void TraceEventSyntheticDelay::SetTargetDuration(
- base::TimeDelta target_duration) {
+void TraceEventSyntheticDelay::SetTargetDuration(TimeDelta target_duration) {
AutoLock lock(lock_);
target_duration_ = target_duration;
trigger_count_ = 0;
@@ -85,7 +84,7 @@ void TraceEventSyntheticDelay::Begin() {
if (!target_duration_.ToInternalValue())
return;
- base::TimeTicks start_time = clock_->Now();
+ TimeTicks start_time = clock_->Now();
{
AutoLock lock(lock_);
if (++begin_count_ != 1)
@@ -94,15 +93,15 @@ void TraceEventSyntheticDelay::Begin() {
}
}
-void TraceEventSyntheticDelay::BeginParallel(base::TimeTicks* out_end_time) {
+void TraceEventSyntheticDelay::BeginParallel(TimeTicks* out_end_time) {
// See note in Begin().
ANNOTATE_BENIGN_RACE(&target_duration_, "Synthetic delay duration");
if (!target_duration_.ToInternalValue()) {
- *out_end_time = base::TimeTicks();
+ *out_end_time = TimeTicks();
return;
}
- base::TimeTicks start_time = clock_->Now();
+ TimeTicks start_time = clock_->Now();
{
AutoLock lock(lock_);
*out_end_time = CalculateEndTimeLocked(start_time);
@@ -115,7 +114,7 @@ void TraceEventSyntheticDelay::End() {
if (!target_duration_.ToInternalValue())
return;
- base::TimeTicks end_time;
+ TimeTicks end_time;
{
AutoLock lock(lock_);
if (!begin_count_ || --begin_count_ != 0)
@@ -126,21 +125,21 @@ void TraceEventSyntheticDelay::End() {
ApplyDelay(end_time);
}
-void TraceEventSyntheticDelay::EndParallel(base::TimeTicks end_time) {
+void TraceEventSyntheticDelay::EndParallel(TimeTicks end_time) {
if (!end_time.is_null())
ApplyDelay(end_time);
}
-base::TimeTicks TraceEventSyntheticDelay::CalculateEndTimeLocked(
- base::TimeTicks start_time) {
+TimeTicks TraceEventSyntheticDelay::CalculateEndTimeLocked(
+ TimeTicks start_time) {
if (mode_ == ONE_SHOT && trigger_count_++)
- return base::TimeTicks();
+ return TimeTicks();
else if (mode_ == ALTERNATING && trigger_count_++ % 2)
- return base::TimeTicks();
+ return TimeTicks();
return start_time + target_duration_;
}
-void TraceEventSyntheticDelay::ApplyDelay(base::TimeTicks end_time) {
+void TraceEventSyntheticDelay::ApplyDelay(TimeTicks end_time) {
TRACE_EVENT0("synthetic_delay", name_.c_str());
while (clock_->Now() < end_time) {
// Busy loop.
@@ -161,14 +160,14 @@ TraceEventSyntheticDelay* TraceEventSyntheticDelayRegistry::GetOrCreateDelay(
const char* name) {
// Try to find an existing delay first without locking to make the common case
// fast.
- int delay_count = base::subtle::Acquire_Load(&delay_count_);
+ int delay_count = subtle::Acquire_Load(&delay_count_);
for (int i = 0; i < delay_count; ++i) {
if (!strcmp(name, delays_[i].name_.c_str()))
return &delays_[i];
}
AutoLock lock(lock_);
- delay_count = base::subtle::Acquire_Load(&delay_count_);
+ delay_count = subtle::Acquire_Load(&delay_count_);
for (int i = 0; i < delay_count; ++i) {
if (!strcmp(name, delays_[i].name_.c_str()))
return &delays_[i];
@@ -180,19 +179,19 @@ TraceEventSyntheticDelay* TraceEventSyntheticDelayRegistry::GetOrCreateDelay(
return &dummy_delay_;
delays_[delay_count].Initialize(std::string(name), this);
- base::subtle::Release_Store(&delay_count_, delay_count + 1);
+ subtle::Release_Store(&delay_count_, delay_count + 1);
return &delays_[delay_count];
}
-base::TimeTicks TraceEventSyntheticDelayRegistry::Now() {
- return base::TimeTicks::Now();
+TimeTicks TraceEventSyntheticDelayRegistry::Now() {
+ return TimeTicks::Now();
}
void TraceEventSyntheticDelayRegistry::ResetAllDelays() {
AutoLock lock(lock_);
- int delay_count = base::subtle::Acquire_Load(&delay_count_);
+ int delay_count = subtle::Acquire_Load(&delay_count_);
for (int i = 0; i < delay_count; ++i) {
- delays_[i].SetTargetDuration(base::TimeDelta());
+ delays_[i].SetTargetDuration(TimeDelta());
delays_[i].SetClock(this);
}
}
diff --git a/base/trace_event/trace_event_win.h b/base/trace_event/trace_event_win.h
index 4161361..e64be4d 100644
--- a/base/trace_event/trace_event_win.h
+++ b/base/trace_event/trace_event_win.h
@@ -12,11 +12,11 @@
#include "base/trace_event/trace_event.h"
#include "base/win/event_trace_provider.h"
-// Fwd.
+namespace base {
+
template <typename Type>
struct StaticMemorySingletonTraits;
-namespace base {
namespace trace_event {
// This EtwTraceProvider subclass implements ETW logging
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index f6c9115..e333155 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -39,18 +39,22 @@
#include "base/trace_event/trace_event_win.h"
#endif
+// The thread buckets for the sampling profiler.
+BASE_EXPORT TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
+
+namespace base {
+namespace internal {
+
class DeleteTraceLogForTesting {
public:
static void Delete() {
- Singleton<base::trace_event::TraceLog,
- LeakySingletonTraits<base::trace_event::TraceLog>>::OnExit(0);
+ Singleton<trace_event::TraceLog,
+ LeakySingletonTraits<trace_event::TraceLog>>::OnExit(0);
}
};
-// The thread buckets for the sampling profiler.
-BASE_EXPORT TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
+} // namespace internal
-namespace base {
namespace trace_event {
namespace {
@@ -1595,7 +1599,7 @@ void TraceLog::WaitSamplingEventForTesting() {
}
void TraceLog::DeleteForTesting() {
- DeleteTraceLogForTesting::Delete();
+ internal::DeleteTraceLogForTesting::Delete();
}
TraceEvent* TraceLog::GetEventByHandle(TraceEventHandle handle) {
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h
index dedebce..3acb918 100644
--- a/base/trace_event/trace_log.h
+++ b/base/trace_event/trace_log.h
@@ -25,11 +25,10 @@
TRACE_EVENT_PHASE_INSTANT, name, reinterpret_cast<const void*>(id), \
extra)
-template <typename Type>
-struct DefaultSingletonTraits;
-
namespace base {
+template <typename Type>
+struct DefaultSingletonTraits;
class RefCountedString;
namespace trace_event {