Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1128)

Unified Diff: third_party/re2/util/logging.h

Issue 10873029: Migrate WebRequestRedirectByRegExAction to use RE2 and roll RE2 to revision 97:401ab4168e8e (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/re2/testing/set_test.cc ('k') | third_party/re2/util/mutex.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/util/logging.h
diff --git a/third_party/re2/util/logging.h b/third_party/re2/util/logging.h
index 53f7198c8ac3e8d81cfb4ca1801ec3031c3e2db9..7302ea691fa5daa13af922c4b28b51471a146f33 100644
--- a/third_party/re2/util/logging.h
+++ b/third_party/re2/util/logging.h
@@ -53,17 +53,24 @@
class LogMessage {
public:
- LogMessage(const char* file, int line) {
+ LogMessage(const char* file, int line) : flushed_(false) {
stream() << file << ":" << line << ": ";
}
- ~LogMessage() {
+ void Flush() {
stream() << "\n";
string s = str_.str();
if(write(2, s.data(), s.size()) < 0) {} // shut up gcc
+ flushed_ = true;
+ }
+ ~LogMessage() {
+ if (!flushed_) {
+ Flush();
+ }
}
ostream& stream() { return str_; }
private:
+ bool flushed_;
std::ostringstream str_;
DISALLOW_EVIL_CONSTRUCTORS(LogMessage);
};
@@ -73,7 +80,7 @@ class LogMessageFatal : public LogMessage {
LogMessageFatal(const char* file, int line)
: LogMessage(file, line) { }
~LogMessageFatal() {
- std::cerr << "\n";
+ Flush();
abort();
}
private:
« no previous file with comments | « third_party/re2/re2/testing/set_test.cc ('k') | third_party/re2/util/mutex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698