public: \
static classname *Instance(bool create_if_needed = true) { \
static classname *instance = nullptr; \
if (!instance && create_if_needed) { \
static std::once_flag flag; \
std::call_once(flag, \
[&] { instance = new (std::nothrow) classname(); }); \
} \
return instance; \
} \
\
if (instance != nullptr) { \
CallShutdown(instance); \
} \
} \
\
private: \
classname(); \
DISALLOW_COPY_AND_ASSIGN(classname)
53 : \
54 static classname *
Instance(
bool create_if_needed =
true) { \
55 static classname *instance = nullptr; \
56 if (!instance && create_if_needed) { \
57 static std::once_flag flag; \
58 std::call_once(flag, \
59 [&] { instance = new (std::nothrow) classname(); }); \
60 } \
61 return instance; \
62 } \
63 \
66 if (instance != nullptr) { \
67 CallShutdown(instance); \
68 } \
69 } \
70 \
71 private: \
72 classname(); \
73 DISALLOW_COPY_AND_ASSIGN(classname)