ART: Remove base/logging from heap-inl.h

Hide the single uncommon VLOG and remove the include. Fix up
transitive includes.

Test: m
Change-Id: I917df597cb62c57040c1fb0e0079df4d95e5a658
diff --git a/runtime/cha.cc b/runtime/cha.cc
index 6c011e8..a53d7e5 100644
--- a/runtime/cha.cc
+++ b/runtime/cha.cc
@@ -17,6 +17,7 @@
 #include "cha.h"
 
 #include "art_method-inl.h"
+#include "base/logging.h"  // For VLOG
 #include "jit/jit.h"
 #include "jit/jit_code_cache.h"
 #include "linear_alloc.h"
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 5be8d5b..0f931e3 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -22,6 +22,8 @@
 
 #include <string>
 
+#include <android-base/logging.h>
+
 #include "arch/instruction_set.h"
 #include "base/mutex.h"
 #include "globals.h"
@@ -32,6 +34,9 @@
 
 namespace art {
 
+using LogSeverity = android::base::LogSeverity;
+using ScopedLogSeverity = android::base::ScopedLogSeverity;
+
 // OBJ pointer helpers to avoid needing .Decode everywhere.
 #define EXPECT_OBJ_PTR_EQ(a, b) EXPECT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
 #define ASSERT_OBJ_PTR_EQ(a, b) ASSERT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index 6a4e5b5..f66836f 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -21,6 +21,7 @@
 #include <sys/ucontext.h>
 
 #include "art_method-inl.h"
+#include "base/logging.h"  // For VLOG
 #include "base/safe_copy.h"
 #include "base/stl_util.h"
 #include "dex_file_types.h"
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 1b3d0da..0dd05cd 100644
--- a/runtime/gc/accounting/mod_union_table.cc
+++ b/runtime/gc/accounting/mod_union_table.cc
@@ -18,6 +18,7 @@
 
 #include <memory>
 
+#include "base/logging.h"  // For VLOG
 #include "base/stl_util.h"
 #include "bitmap-inl.h"
 #include "card_table-inl.h"
diff --git a/runtime/gc/allocation_record.cc b/runtime/gc/allocation_record.cc
index 2257b81..2ee4239 100644
--- a/runtime/gc/allocation_record.cc
+++ b/runtime/gc/allocation_record.cc
@@ -18,6 +18,7 @@
 
 #include "art_method-inl.h"
 #include "base/enums.h"
+#include "base/logging.h"  // For VLOG
 #include "base/stl_util.h"
 #include "obj_ptr-inl.h"
 #include "object_callbacks.h"
diff --git a/runtime/gc/allocator/rosalloc.cc b/runtime/gc/allocator/rosalloc.cc
index b742ac4..928abe8 100644
--- a/runtime/gc/allocator/rosalloc.cc
+++ b/runtime/gc/allocator/rosalloc.cc
@@ -23,6 +23,7 @@
 
 #include "android-base/stringprintf.h"
 
+#include "base/logging.h"  // For VLOG
 #include "base/memory_tool.h"
 #include "base/mutex-inl.h"
 #include "gc/space/memory_tool_settings.h"
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 141efd2..52dd104 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -20,7 +20,6 @@
 #include "heap.h"
 
 #include "allocation_listener.h"
-#include "base/logging.h"  // For VLOG.
 #include "base/time_utils.h"
 #include "gc/accounting/atomic_stack.h"
 #include "gc/accounting/card_table-inl.h"
@@ -402,8 +401,7 @@
         return true;
       }
       // TODO: Grow for allocation is racy, fix it.
-      VLOG(heap) << "Growing heap from " << PrettySize(max_allowed_footprint_) << " to "
-          << PrettySize(new_footprint) << " for a " << PrettySize(alloc_size) << " allocation";
+      VlogHeapGrowth(max_allowed_footprint_, new_footprint, alloc_size);
       max_allowed_footprint_ = new_footprint;
     }
   }
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index f29ae92..91f1ff6 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -30,6 +30,7 @@
 #include "base/dumpable.h"
 #include "base/file_utils.h"
 #include "base/histogram-inl.h"
+#include "base/logging.h"  // For VLOG.
 #include "base/memory_tool.h"
 #include "base/stl_util.h"
 #include "base/systrace.h"
@@ -4156,5 +4157,10 @@
   return verification_.get();
 }
 
+void Heap::VlogHeapGrowth(size_t max_allowed_footprint, size_t new_footprint, size_t alloc_size) {
+  VLOG(heap) << "Growing heap from " << PrettySize(max_allowed_footprint) << " to "
+             << PrettySize(new_footprint) << " for a " << PrettySize(alloc_size) << " allocation";
+}
+
 }  // namespace gc
 }  // namespace art
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index bb21b7c..0d11658 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -1099,6 +1099,9 @@
 
   void TraceHeapSize(size_t heap_size);
 
+  // Remove a vlog code from heap-inl.h which is transitively included in half the world.
+  static void VlogHeapGrowth(size_t max_allowed_footprint, size_t new_footprint, size_t alloc_size);
+
   // All-known continuous spaces, where objects lie within fixed bounds.
   std::vector<space::ContinuousSpace*> continuous_spaces_ GUARDED_BY(Locks::mutator_lock_);
 
diff --git a/runtime/gc/space/dlmalloc_space.cc b/runtime/gc/space/dlmalloc_space.cc
index 576a35c..a3eef90 100644
--- a/runtime/gc/space/dlmalloc_space.cc
+++ b/runtime/gc/space/dlmalloc_space.cc
@@ -16,6 +16,7 @@
 
 #include "dlmalloc_space-inl.h"
 
+#include "base/logging.h"  // For VLOG.
 #include "base/time_utils.h"
 #include "gc/accounting/card_table.h"
 #include "gc/accounting/space_bitmap-inl.h"
diff --git a/runtime/gc/space/malloc_space.cc b/runtime/gc/space/malloc_space.cc
index dcb7837..17274b5 100644
--- a/runtime/gc/space/malloc_space.cc
+++ b/runtime/gc/space/malloc_space.cc
@@ -18,6 +18,7 @@
 
 #include "android-base/stringprintf.h"
 
+#include "base/logging.h"  // For VLOG
 #include "gc/accounting/card_table-inl.h"
 #include "gc/accounting/space_bitmap-inl.h"
 #include "gc/heap.h"
diff --git a/runtime/gc/space/rosalloc_space.cc b/runtime/gc/space/rosalloc_space.cc
index 5d1f191..3a685cb 100644
--- a/runtime/gc/space/rosalloc_space.cc
+++ b/runtime/gc/space/rosalloc_space.cc
@@ -17,6 +17,7 @@
 
 #include "rosalloc_space-inl.h"
 
+#include "base/logging.h"  // For VLOG.
 #include "base/time_utils.h"
 #include "gc/accounting/card_table.h"
 #include "gc/accounting/space_bitmap-inl.h"
diff --git a/runtime/gc/verification.cc b/runtime/gc/verification.cc
index 3cd04a6..d99b377 100644
--- a/runtime/gc/verification.cc
+++ b/runtime/gc/verification.cc
@@ -86,7 +86,7 @@
                                      mirror::Object* ref,
                                      bool fatal) const {
   // Lowest priority logging first:
-  PrintFileToLog("/proc/self/maps", LogSeverity::FATAL_WITHOUT_ABORT);
+  PrintFileToLog("/proc/self/maps", android::base::LogSeverity::FATAL_WITHOUT_ABORT);
   MemMap::DumpMaps(LOG_STREAM(FATAL_WITHOUT_ABORT), true);
   // Buffer the output in the string stream since it is more important than the stack traces
   // and we want it to have log priority. The stack traces are printed from Runtime::Abort
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index a5c167e..6f03a68 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -21,6 +21,7 @@
 #include "arch/context.h"
 #include "art_method-inl.h"
 #include "base/enums.h"
+#include "base/logging.h"  // For VLOG.
 #include "base/stl_util.h"
 #include "base/systrace.h"
 #include "base/time_utils.h"
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index acbc6e6..ee11cfd 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -25,6 +25,7 @@
 
 #include "art_method-inl.h"
 #include "base/enums.h"
+#include "base/logging.h"  // For VLOG.
 #include "base/scoped_arena_containers.h"
 #include "base/stl_util.h"
 #include "base/systrace.h"
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 892c039..a0a2f46 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -20,6 +20,7 @@
 
 #include "art_field-inl.h"
 #include "art_method-inl.h"
+#include "base/logging.h"  // For VLOG.
 #include "class-inl.h"
 #include "class_ext.h"
 #include "class_linker-inl.h"
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index d5520d9..1252905 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -21,6 +21,7 @@
 #include "android-base/stringprintf.h"
 
 #include "art_method-inl.h"
+#include "base/logging.h"  // For VLOG.
 #include "base/mutex.h"
 #include "base/stl_util.h"
 #include "base/systrace.h"
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index c82df71..32f8df7 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -39,6 +39,7 @@
 #include "base/bit_vector.h"
 #include "base/enums.h"
 #include "base/file_utils.h"
+#include "base/logging.h"  // For VLOG_IS_ON.
 #include "base/stl_util.h"
 #include "base/systrace.h"
 #include "base/unix_file/fd_file.h"
@@ -314,7 +315,7 @@
   if (requested_base != nullptr && begin_ != requested_base) {
     // Host can fail this check. Do not dump there to avoid polluting the output.
     if (kIsTargetBuild && (kIsDebugBuild || VLOG_IS_ON(oat))) {
-      PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
+      PrintFileToLog("/proc/self/maps", android::base::LogSeverity::WARNING);
     }
     *error_msg = StringPrintf("Failed to find oatdata symbol at expected address: "
         "oatdata=%p != expected=%p. See process maps in the log.",
@@ -1068,7 +1069,7 @@
     dl_iterate_context context0 = { Begin(), &dlopen_mmaps_, 0, 0};
     if (dl_iterate_phdr(dl_iterate_context::callback, &context0) == 0) {
       // OK, give up and print an error.
-      PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
+      PrintFileToLog("/proc/self/maps", android::base::LogSeverity::WARNING);
       LOG(ERROR) << "File " << elf_filename << " loaded with dlopen but cannot find its mmaps.";
     }
   }
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index f94923e..a7771ab 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -19,6 +19,7 @@
 #include "arch/context.h"
 #include "art_method-inl.h"
 #include "base/enums.h"
+#include "base/logging.h"  // For VLOG_IS_ON.
 #include "dex_file_types.h"
 #include "dex_instruction.h"
 #include "entrypoints/entrypoint_utils.h"