summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 18:16:10 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 18:16:10 +0000
commit4c9e6cbf9921ba74c6de3f863947ec51c4837316 (patch)
tree9f112dba138967554c56836209ad34d123f2caaa /gpu/command_buffer
parente1b67386a34c21c91d37c4335ef72e75e38637dc (diff)
downloadchromium_src-4c9e6cbf9921ba74c6de3f863947ec51c4837316.zip
chromium_src-4c9e6cbf9921ba74c6de3f863947ec51c4837316.tar.gz
chromium_src-4c9e6cbf9921ba74c6de3f863947ec51c4837316.tar.bz2
Removed includion of <iostream> from logging.h.
So that it does not introduce static initializers into including files. TEST=try BUG=54904 Review URL: http://codereview.chromium.org/3354018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/common/logging.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/gpu/command_buffer/common/logging.h b/gpu/command_buffer/common/logging.h
index 191f711a..b183683 100644
--- a/gpu/command_buffer/common/logging.h
+++ b/gpu/command_buffer/common/logging.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -6,8 +6,10 @@
#define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_
#include <assert.h>
+#include <stdio.h>
-#include <iostream>
+#include <sstream>
+#include <string>
// Windows defines an ERROR macro.
#ifdef ERROR
@@ -26,8 +28,8 @@ enum LogLevel {
};
// This is a very simple logger for use in command buffer code. Common and
-// command buffer code cannot be dependent on base. It just outputs the message
-// to stderr.
+// client side command buffer code cannot be dependent on base. It just outputs
+// the message to stderr, flushes and asserts if the error was fatal.
class Logger {
public:
Logger(bool condition, LogLevel level)
@@ -113,8 +115,9 @@ class Logger {
~Logger() {
if (!condition_) {
- std::cerr << std::endl;
- std::cerr.flush();
+ message_stream_ << std::endl;
+ fputs(message_stream_.str().c_str(), stderr);
+ fflush(stderr);
if (level_ == FATAL)
assert(false);
}
@@ -123,7 +126,7 @@ class Logger {
template <typename T>
Logger& operator<<(const T& value) {
if (!condition_)
- std::cerr << value;
+ message_stream_ << value;
return *this;
}
@@ -131,6 +134,7 @@ class Logger {
Logger(const Logger& logger): condition_(logger.condition_) {
}
+ std::stringstream message_stream_;
bool condition_;
LogLevel level_;
};