diff options
-rw-r--r-- | base/logging.cc | 15 | ||||
-rw-r--r-- | base/logging.h | 12 | ||||
-rw-r--r-- | base/string_piece.cc | 7 | ||||
-rw-r--r-- | base/string_piece.h | 6 | ||||
-rw-r--r-- | chrome/renderer/extensions/chrome_v8_extension.h | 3 | ||||
-rw-r--r-- | net/dns/dns_transaction.h | 3 |
6 files changed, 19 insertions, 27 deletions
diff --git a/base/logging.cc b/base/logging.cc index 1a51312..fabe3f7 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -835,20 +835,11 @@ void RawLog(int level, const char* message) { base::debug::BreakDebugger(); } +// This was defined at the beginning of this file. +#undef write + } // namespace logging std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { return out << WideToUTF8(std::wstring(wstr)); } - -namespace base { - -// This was defined at the beginnig of this file. -#undef write - -std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { - o.write(piece.data(), static_cast<std::streamsize>(piece.size())); - return o; -} - -} // namespace base diff --git a/base/logging.h b/base/logging.h index 9c660fa..df31955 100644 --- a/base/logging.h +++ b/base/logging.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -981,14 +981,4 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { } while(0) #endif -namespace base { - -template <typename STRING_TYPE> class BasicStringPiece; -typedef BasicStringPiece<std::string> StringPiece; - -// Allows StringPiece to be logged. -BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); - -} // namespace base - #endif // BASE_LOGGING_H_ diff --git a/base/string_piece.cc b/base/string_piece.cc index 27f0013..7a41361 100644 --- a/base/string_piece.cc +++ b/base/string_piece.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. // Copied from strings/stringpiece.cc with modifications @@ -27,6 +27,11 @@ bool operator==(const StringPiece& x, const StringPiece& y) { return StringPiece::wordmemcmp(x.data(), y.data(), x.size()) == 0; } +std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { + o.write(piece.data(), static_cast<std::streamsize>(piece.size())); + return o; +} + namespace internal { void CopyToString(const StringPiece& self, std::string* target) { target->assign(!self.empty() ? self.data() : "", self.size()); diff --git a/base/string_piece.h b/base/string_piece.h index e68302e..7bce4ff 100644 --- a/base/string_piece.h +++ b/base/string_piece.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. // Copied from strings/stringpiece.h with modifications @@ -24,6 +24,7 @@ #define BASE_STRING_PIECE_H_ #pragma once +#include <iosfwd> #include <string> #include "base/base_export.h" @@ -399,6 +400,9 @@ inline bool operator>=(const StringPiece16& x, const StringPiece16& y) { return !(x < y); } +BASE_EXPORT std::ostream& operator<<(std::ostream& o, + const StringPiece& piece); + } // namespace base // We provide appropriate hash functions so StringPiece and StringPiece16 can diff --git a/chrome/renderer/extensions/chrome_v8_extension.h b/chrome/renderer/extensions/chrome_v8_extension.h index a779f91..511273f 100644 --- a/chrome/renderer/extensions/chrome_v8_extension.h +++ b/chrome/renderer/extensions/chrome_v8_extension.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/memory/linked_ptr.h" +#include "base/string_piece.h" #include "chrome/renderer/extensions/chrome_v8_extension_handler.h" #include "v8/include/v8.h" diff --git a/net/dns/dns_transaction.h b/net/dns/dns_transaction.h index e6a1d02..443cfae 100644 --- a/net/dns/dns_transaction.h +++ b/net/dns/dns_transaction.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/string_piece.h" #include "base/timer.h" #include "base/threading/non_thread_safe.h" #include "net/base/completion_callback.h" |