Make Config::default_value leak instead of having an exit-time destructor.

I wanted to use Config::Get in Chromium code, but it triggered the following
warning:
../../third_party/webrtc/common.h:89:20: error: declaration requires an exit-time destructor [-Werror,-Wexit-time-destructors]
    static const T def;
                   ^
../../third_party/webrtc/common.h:110:10: note: in instantiation of function template specialization requested here
  return default_value<T>();
         ^

I assume we don't hit this in webrtc because the warning is disabled.

This also switches to the RTC_ prefix from the deprecated LIBJINGLE_.

Needed due to this Chromium CL:
https://codereview.chromium.org/1148843004/

R=andresp@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/53459004

Cr-Commit-Position: refs/heads/master@{#9268}
diff --git a/talk/session/media/srtpfilter.cc b/talk/session/media/srtpfilter.cc
index dc93dd4..b47844f 100644
--- a/talk/session/media/srtpfilter.cc
+++ b/talk/session/media/srtpfilter.cc
@@ -770,7 +770,7 @@
 }
 
 std::list<SrtpSession*>* SrtpSession::sessions() {
-  LIBJINGLE_DEFINE_STATIC_LOCAL(std::list<SrtpSession*>, sessions, ());
+  RTC_DEFINE_STATIC_LOCAL(std::list<SrtpSession*>, sessions, ());
   return &sessions;
 }
 
diff --git a/webrtc/base/basictypes.h b/webrtc/base/basictypes.h
index 6299061..3edf354 100644
--- a/webrtc/base/basictypes.h
+++ b/webrtc/base/basictypes.h
@@ -111,14 +111,16 @@
 
 // The following only works for C++
 #ifdef __cplusplus
+#ifndef ALIGNP
 #define ALIGNP(p, t) \
     (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \
     ((t) - 1)) & ~((t) - 1))))
+#endif
 #define RTC_IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
 
 // Use these to declare and define a static local variable (static T;) so that
 // it is leaked so that its destructors are not called at exit.
-#define LIBJINGLE_DEFINE_STATIC_LOCAL(type, name, arguments) \
+#define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \
   static type& name = *new type arguments
 
 #endif  // __cplusplus
diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc
index bd7ff96..9012c33 100644
--- a/webrtc/base/helpers.cc
+++ b/webrtc/base/helpers.cc
@@ -180,8 +180,8 @@
 // This round about way of creating a global RNG is to safe-guard against
 // indeterminant static initialization order.
 scoped_ptr<RandomGenerator>& GetGlobalRng() {
-  LIBJINGLE_DEFINE_STATIC_LOCAL(scoped_ptr<RandomGenerator>, global_rng,
-                                (new SecureRandomGenerator()));
+  RTC_DEFINE_STATIC_LOCAL(scoped_ptr<RandomGenerator>, global_rng,
+                          (new SecureRandomGenerator()));
   return global_rng;
 }
 
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index bc3fb32..b9c2a07 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -622,7 +622,7 @@
   // sort of user-defined void * parameter, so they can't access anything that
   // isn't global.)
   static PosixSignalHandler* Instance() {
-    LIBJINGLE_DEFINE_STATIC_LOCAL(PosixSignalHandler, instance, ());
+    RTC_DEFINE_STATIC_LOCAL(PosixSignalHandler, instance, ());
     return &instance;
   }
 
diff --git a/webrtc/base/profiler.cc b/webrtc/base/profiler.cc
index e0bd431..9f781fb 100644
--- a/webrtc/base/profiler.cc
+++ b/webrtc/base/profiler.cc
@@ -89,7 +89,7 @@
 Profiler::~Profiler() = default;
 
 Profiler* Profiler::Instance() {
-  LIBJINGLE_DEFINE_STATIC_LOCAL(Profiler, instance, ());
+  RTC_DEFINE_STATIC_LOCAL(Profiler, instance, ());
   return &instance;
 }
 
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index 21109fa..48a9144 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -36,7 +36,7 @@
 namespace rtc {
 
 ThreadManager* ThreadManager::Instance() {
-  LIBJINGLE_DEFINE_STATIC_LOCAL(ThreadManager, thread_manager, ());
+  RTC_DEFINE_STATIC_LOCAL(ThreadManager, thread_manager, ());
   return &thread_manager;
 }
 
diff --git a/webrtc/common.h b/webrtc/common.h
index 6ead409..d0d7eb1 100644
--- a/webrtc/common.h
+++ b/webrtc/common.h
@@ -13,6 +13,8 @@
 
 #include <map>
 
+#include "webrtc/base/basictypes.h"
+
 namespace webrtc {
 
 // Class Config is designed to ease passing a set of options across webrtc code.
@@ -86,7 +88,7 @@
   // locks.
   template<typename T>
   static const T& default_value() {
-    static const T def;
+    RTC_DEFINE_STATIC_LOCAL(const T, def, ());
     return def;
   }
 
diff --git a/webrtc/overrides/webrtc/base/basictypes.h b/webrtc/overrides/webrtc/base/basictypes.h
index c32d8b6..e75b8c8 100644
--- a/webrtc/overrides/webrtc/base/basictypes.h
+++ b/webrtc/overrides/webrtc/base/basictypes.h
@@ -86,14 +86,15 @@
 #else  // !WEBRTC_WIN
 #define alignof(t) __alignof__(t)
 #endif  // !WEBRTC_WIN
-#define RTC_IS_ALIGNED(p, a) (0==(reinterpret_cast<uintptr_t>(p) & ((a)-1)))
+#ifndef ALIGNP
 #define ALIGNP(p, t) \
   (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \
   ((t)-1)) & ~((t)-1))))
+#endif
+#define RTC_IS_ALIGNED(p, a) (0==(reinterpret_cast<uintptr_t>(p) & ((a)-1)))
 
-// LIBJINGLE_DEFINE_STATIC_LOCAL() is a libjingle's copy
-// of CR_DEFINE_STATIC_LOCAL().
-#define LIBJINGLE_DEFINE_STATIC_LOCAL(type, name, arguments) \
+// RTC_DEFINE_STATIC_LOCAL() is libjingle's copy of CR_DEFINE_STATIC_LOCAL().
+#define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \
   CR_DEFINE_STATIC_LOCAL(type, name, arguments)
 
 #endif // OVERRIDES_WEBRTC_BASE_BASICTYPES_H__