ART: Factor out gAborting

Cut dependencies on base/logging.h by moving gAborting to its
own header. Leave the static storage in logging.cc.

Test: m
Change-Id: Ib2ca880e15f9cb50cb9aab803784826bb46efb5e
diff --git a/runtime/barrier.cc b/runtime/barrier.cc
index 8d3bc0e..4329a5a 100644
--- a/runtime/barrier.cc
+++ b/runtime/barrier.cc
@@ -16,7 +16,9 @@
 
 #include "barrier.h"
 
-#include "base/logging.h"  // Required for gAborting.
+#include <android-base/logging.h>
+
+#include "base/aborting.h"
 #include "base/mutex.h"
 #include "base/time_utils.h"
 #include "thread.h"
diff --git a/runtime/base/aborting.h b/runtime/base/aborting.h
new file mode 100644
index 0000000..8906c96
--- /dev/null
+++ b/runtime/base/aborting.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_BASE_ABORTING_H_
+#define ART_RUNTIME_BASE_ABORTING_H_
+
+#include <atomic>
+
+namespace art {
+
+// 0 if not abort, non-zero if an abort is in progress. Used on fatal exit to prevents recursive
+// aborts. Global declaration allows us to disable some error checking to ensure fatal shutdown
+// makes forward progress.
+extern std::atomic<unsigned int> gAborting;
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_BASE_ABORTING_H_
diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc
index 323a065..db49860 100644
--- a/runtime/base/file_utils.cc
+++ b/runtime/base/file_utils.cc
@@ -89,7 +89,7 @@
   }
 }
 
-bool PrintFileToLog(const std::string& file_name, LogSeverity level) {
+bool PrintFileToLog(const std::string& file_name, android::base::LogSeverity level) {
   File file(file_name, O_RDONLY, false);
   if (!file.IsOpened()) {
     return false;
diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc
index 26106ee..90eb74c 100644
--- a/runtime/base/logging.cc
+++ b/runtime/base/logging.cc
@@ -20,7 +20,8 @@
 #include <limits>
 #include <sstream>
 
-#include "base/mutex.h"
+#include "aborting.h"
+#include "mutex.h"
 #include "thread-current-inl.h"
 #include "utils.h"
 
diff --git a/runtime/base/logging.h b/runtime/base/logging.h
index 981fbbf..c562bdf 100644
--- a/runtime/base/logging.h
+++ b/runtime/base/logging.h
@@ -63,11 +63,6 @@
 // Global log verbosity setting, initialized by InitLogging.
 extern LogVerbosity gLogVerbosity;
 
-// 0 if not abort, non-zero if an abort is in progress. Used on fatal exit to prevents recursive
-// aborts. Global declaration allows us to disable some error checking to ensure fatal shutdown
-// makes forward progress.
-extern std::atomic<unsigned int> gAborting;
-
 // Configure logging based on ANDROID_LOG_TAGS environment variable.
 // We need to parse a string that looks like
 //
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 9a037b5..7077298 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -27,7 +27,7 @@
 #include <android-base/logging.h>
 
 #include "atomic.h"
-#include "base/logging.h"  // For gAborting.
+#include "base/aborting.h"
 #include "base/macros.h"
 #include "globals.h"
 
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 2047646..141efd2 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -20,6 +20,7 @@
 #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"
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index 841506b..ec94552 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -40,8 +40,8 @@
 #include "android-base/stringprintf.h"
 
 #include "arch/instruction_set.h"
+#include "base/aborting.h"
 #include "base/file_utils.h"
-#include "base/logging.h"  // For gAborting.
 #include "base/memory_tool.h"
 #include "base/mutex.h"
 #include "base/unix_file/fd_file.h"
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index d15de38..7239ad3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -57,6 +57,7 @@
 #include "asm_support.h"
 #include "asm_support_check.h"
 #include "atomic.h"
+#include "base/aborting.h"
 #include "base/arena_allocator.h"
 #include "base/dumpable.h"
 #include "base/enums.h"
diff --git a/runtime/runtime_common.cc b/runtime/runtime_common.cc
index b49bec6..59af918 100644
--- a/runtime/runtime_common.cc
+++ b/runtime/runtime_common.cc
@@ -26,8 +26,9 @@
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
 
+#include "base/aborting.h"
 #include "base/file_utils.h"
-#include "base/logging.h"  // For gAborting.
+#include "base/logging.h"  // For LogHelper, GetCmdLine.
 #include "base/macros.h"
 #include "base/mutex.h"
 #include "native_stack_dump.h"
@@ -431,7 +432,7 @@
     logger(LOG_STREAM(FATAL_WITHOUT_ABORT));
   }
   if (kIsDebugBuild && signal_number == SIGSEGV) {
-    PrintFileToLog("/proc/self/maps", LogSeverity::FATAL_WITHOUT_ABORT);
+    PrintFileToLog("/proc/self/maps", android::base::LogSeverity::FATAL_WITHOUT_ABORT);
   }
 
   Runtime* runtime = Runtime::Current();
diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc
index bf5d718..d9c4da9 100644
--- a/runtime/signal_catcher.cc
+++ b/runtime/signal_catcher.cc
@@ -35,6 +35,7 @@
 
 #include "arch/instruction_set.h"
 #include "base/file_utils.h"
+#include "base/logging.h"  // For GetCmdLine.
 #include "base/time_utils.h"
 #include "base/unix_file/fd_file.h"
 #include "class_linker.h"
diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h
index 9d08531..62b0789 100644
--- a/runtime/thread-inl.h
+++ b/runtime/thread-inl.h
@@ -19,8 +19,8 @@
 
 #include "thread.h"
 
+#include "base/aborting.h"
 #include "base/casts.h"
-#include "base/logging.h"  // For gAborting.
 #include "base/mutex-inl.h"
 #include "base/time_utils.h"
 #include "jni_env_ext.h"
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 9f55314..8754819 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -28,6 +28,7 @@
 #include "nativehelper/scoped_local_ref.h"
 #include "nativehelper/scoped_utf_chars.h"
 
+#include "base/aborting.h"
 #include "base/histogram-inl.h"
 #include "base/mutex-inl.h"
 #include "base/systrace.h"
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index f10cd37..82820fd 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -22,6 +22,7 @@
 
 #include "art_field-inl.h"
 #include "art_method-inl.h"
+#include "base/aborting.h"
 #include "base/enums.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/mutex-inl.h"
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index a3f08c8..c68fa0f 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -18,6 +18,7 @@
 
 #include <type_traits>
 
+#include "base/aborting.h"
 #include "base/arena_bit_vector.h"
 #include "base/bit_vector-inl.h"
 #include "base/casts.h"