Index: gpu/command_buffer/common/logging_android.cc |
diff --git a/gpu/command_buffer/common/logging_android.cc b/gpu/command_buffer/common/logging_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd95ae2d5e33e7e9b0953b294336894e82a532c0 |
--- /dev/null |
+++ b/gpu/command_buffer/common/logging_android.cc |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <android/log.h> |
+#include <iostream> |
+#include <sstream> |
+ |
+#include "gpu/command_buffer/common/logging.h" |
+ |
+namespace gpu { |
+ |
+namespace { |
+std::stringstream* g_log; |
+const char* kLogTag = "chromium-gpu"; |
+} |
+ |
+std::ostream& Logger::stream() { |
+ if (!g_log) |
+ g_log = new std::stringstream(); |
+ return *g_log; |
+} |
+ |
+Logger::~Logger() { |
+ if (!condition_) { |
+ __android_log_print(ANDROID_LOG_INFO, kLogTag, "%s", g_log->str().c_str()); |
+ g_log->str(std::string()); |
+ if (level_ == FATAL) |
+ assert(false); |
+ } |
+} |
+ |
+} // namespace gpu |