Drop "using namespace" in base/allocator

The code style guide does not allow "using namespace" and they
have a tendency to cause problems with jumbo builds. This patch
removes a "using namespace" in base.

Change-Id: I6b97574d6348e1b8df537708e99d89b97d6fc75e
Reviewed-on: https://chromium-review.googlesource.com/c/1443018
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#627356}
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index 1233ae2a..20fd375 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -35,10 +35,9 @@
 
 namespace {
 
-using namespace base;
-
-subtle::AtomicWord g_chain_head = reinterpret_cast<subtle::AtomicWord>(
-    &allocator::AllocatorDispatch::default_dispatch);
+base::subtle::AtomicWord g_chain_head =
+    reinterpret_cast<base::subtle::AtomicWord>(
+        &base::allocator::AllocatorDispatch::default_dispatch);
 
 bool g_call_new_handler_on_malloc_failure = false;
 
@@ -65,15 +64,15 @@
 #endif
 }
 
-inline const allocator::AllocatorDispatch* GetChainHead() {
+inline const base::allocator::AllocatorDispatch* GetChainHead() {
   // TODO(primiano): Just use NoBarrier_Load once crbug.com/593344 is fixed.
   // Unfortunately due to that bug NoBarrier_Load() is mistakenly fully
   // barriered on Linux+Clang, and that causes visible perf regressons.
-  return reinterpret_cast<const allocator::AllocatorDispatch*>(
+  return reinterpret_cast<const base::allocator::AllocatorDispatch*>(
 #if defined(OS_LINUX) && defined(__clang__)
-      *static_cast<const volatile subtle::AtomicWord*>(&g_chain_head)
+      *static_cast<const volatile base::subtle::AtomicWord*>(&g_chain_head)
 #else
-      subtle::NoBarrier_Load(&g_chain_head)
+      base::subtle::NoBarrier_Load(&g_chain_head)
 #endif
   );
 }
@@ -150,7 +149,7 @@
 //     - Assume it did succeed if it returns, in which case reattempt the alloc.
 
 ALWAYS_INLINE void* ShimCppNew(size_t size) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     void* context = nullptr;
@@ -163,7 +162,7 @@
 }
 
 ALWAYS_INLINE void* ShimCppAlignedNew(size_t size, size_t alignment) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     void* context = nullptr;
@@ -181,12 +180,12 @@
 #if defined(OS_MACOSX)
   context = malloc_default_zone();
 #endif
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->free_function(chain_head, address, context);
 }
 
 ALWAYS_INLINE void* ShimMalloc(size_t size, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     ptr = chain_head->alloc_function(chain_head, size, context);
@@ -196,7 +195,7 @@
 }
 
 ALWAYS_INLINE void* ShimCalloc(size_t n, size_t size, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     ptr = chain_head->alloc_zero_initialized_function(chain_head, n, size,
@@ -209,7 +208,7 @@
 ALWAYS_INLINE void* ShimRealloc(void* address, size_t size, void* context) {
   // realloc(size == 0) means free() and might return a nullptr. We should
   // not call the std::new_handler in that case, though.
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     ptr = chain_head->realloc_function(chain_head, address, size, context);
@@ -219,7 +218,7 @@
 }
 
 ALWAYS_INLINE void* ShimMemalign(size_t alignment, size_t size, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr;
   do {
     ptr = chain_head->alloc_aligned_function(chain_head, alignment, size,
@@ -258,12 +257,12 @@
 }
 
 ALWAYS_INLINE void ShimFree(void* address, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->free_function(chain_head, address, context);
 }
 
 ALWAYS_INLINE size_t ShimGetSizeEstimate(const void* address, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->get_size_estimate_function(
       chain_head, const_cast<void*>(address), context);
 }
@@ -272,7 +271,7 @@
                                        void** results,
                                        unsigned num_requested,
                                        void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->batch_malloc_function(chain_head, size, results,
                                            num_requested, context);
 }
@@ -280,13 +279,13 @@
 ALWAYS_INLINE void ShimBatchFree(void** to_be_freed,
                                  unsigned num_to_be_freed,
                                  void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->batch_free_function(chain_head, to_be_freed,
                                          num_to_be_freed, context);
 }
 
 ALWAYS_INLINE void ShimFreeDefiniteSize(void* ptr, size_t size, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->free_definite_size_function(chain_head, ptr, size,
                                                  context);
 }
@@ -294,7 +293,7 @@
 ALWAYS_INLINE void* ShimAlignedMalloc(size_t size,
                                       size_t alignment,
                                       void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr = nullptr;
   do {
     ptr = chain_head->aligned_malloc_function(chain_head, size, alignment,
@@ -310,7 +309,7 @@
                                        void* context) {
   // _aligned_realloc(size == 0) means _aligned_free() and might return a
   // nullptr. We should not call the std::new_handler in that case, though.
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   void* ptr = nullptr;
   do {
     ptr = chain_head->aligned_realloc_function(chain_head, address, size,
@@ -321,7 +320,7 @@
 }
 
 ALWAYS_INLINE void ShimAlignedFree(void* address, void* context) {
-  const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+  const base::allocator::AllocatorDispatch* const chain_head = GetChainHead();
   return chain_head->aligned_free_function(chain_head, address, context);
 }