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

Unified Diff: third_party/WebKit/Source/wtf/PrintStream.h

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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/WebKit/Source/wtf/PassRefPtr.h ('k') | third_party/WebKit/Source/wtf/PrintStream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/PrintStream.h
diff --git a/third_party/WebKit/Source/wtf/PrintStream.h b/third_party/WebKit/Source/wtf/PrintStream.h
index 27bd33e7c6d3ddf1c5d31710d5878da1a459b45f..dfd4fbc16f3cbcf72bd618ba35599f858808ab80 100644
--- a/third_party/WebKit/Source/wtf/PrintStream.h
+++ b/third_party/WebKit/Source/wtf/PrintStream.h
@@ -38,38 +38,45 @@ class CString;
class String;
class WTF_EXPORT PrintStream {
- USING_FAST_MALLOC(PrintStream); WTF_MAKE_NONCOPYABLE(PrintStream);
-public:
- PrintStream();
- virtual ~PrintStream();
-
- void printf(const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
- virtual void vprintf(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(2, 0) = 0;
-
- // Typically a no-op for many subclasses of PrintStream, this is a hint that
- // the implementation should flush its buffers if it had not done so already.
- virtual void flush();
-
- template <typename T>
- void print(const T& value)
- {
- printInternal(*this, value);
- }
-
- template <typename T1, typename... RemainingTypes>
- void print(const T1& value1, const RemainingTypes&... values)
- {
- print(value1);
- print(values...);
- }
+ USING_FAST_MALLOC(PrintStream);
+ WTF_MAKE_NONCOPYABLE(PrintStream);
+
+ public:
+ PrintStream();
+ virtual ~PrintStream();
+
+ void printf(const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
+ virtual void vprintf(const char* format, va_list)
+ WTF_ATTRIBUTE_PRINTF(2, 0) = 0;
+
+ // Typically a no-op for many subclasses of PrintStream, this is a hint that
+ // the implementation should flush its buffers if it had not done so already.
+ virtual void flush();
+
+ template <typename T>
+ void print(const T& value) {
+ printInternal(*this, value);
+ }
+
+ template <typename T1, typename... RemainingTypes>
+ void print(const T1& value1, const RemainingTypes&... values) {
+ print(value1);
+ print(values...);
+ }
};
WTF_EXPORT void printInternal(PrintStream&, const char*);
WTF_EXPORT void printInternal(PrintStream&, const CString&);
WTF_EXPORT void printInternal(PrintStream&, const String&);
-inline void printInternal(PrintStream& out, char* value) { printInternal(out, static_cast<const char*>(value)); }
-inline void printInternal(PrintStream& out, CString& value) { printInternal(out, static_cast<const CString&>(value)); }
-inline void printInternal(PrintStream& out, String& value) { printInternal(out, static_cast<const String&>(value)); }
+inline void printInternal(PrintStream& out, char* value) {
+ printInternal(out, static_cast<const char*>(value));
+}
+inline void printInternal(PrintStream& out, CString& value) {
+ printInternal(out, static_cast<const CString&>(value));
+}
+inline void printInternal(PrintStream& out, String& value) {
+ printInternal(out, static_cast<const String&>(value));
+}
WTF_EXPORT void printInternal(PrintStream&, bool);
WTF_EXPORT void printInternal(PrintStream&, int);
WTF_EXPORT void printInternal(PrintStream&, unsigned);
@@ -81,46 +88,37 @@ WTF_EXPORT void printInternal(PrintStream&, float);
WTF_EXPORT void printInternal(PrintStream&, double);
template <typename T>
-void printInternal(PrintStream& out, const T& value)
-{
- value.dump(out);
+void printInternal(PrintStream& out, const T& value) {
+ value.dump(out);
}
-#define MAKE_PRINT_ADAPTOR(Name, Type, function) \
- class Name final { \
- STACK_ALLOCATED(); \
- public: \
- Name(const Type& value) \
- : m_value(value) \
- { \
- } \
- void dump(PrintStream& out) const \
- { \
- function(out, m_value); \
- } \
- private: \
- Type m_value; \
- }
-
-#define MAKE_PRINT_METHOD_ADAPTOR(Name, Type, method) \
- class Name final { \
- STACK_ALLOCATED(); \
- public: \
- Name(const Type& value) \
- : m_value(value) \
- { \
- } \
- void dump(PrintStream& out) const \
- { \
- m_value.method(out); \
- } \
- private: \
- const Type& m_value; \
- }
-
-#define MAKE_PRINT_METHOD(Type, dumpMethod, method) \
- MAKE_PRINT_METHOD_ADAPTOR(DumperFor_##method, Type, dumpMethod); \
- DumperFor_##method method() const { return DumperFor_##method(*this); }
+#define MAKE_PRINT_ADAPTOR(Name, Type, function) \
+ class Name final { \
+ STACK_ALLOCATED(); \
+ \
+ public: \
+ Name(const Type& value) : m_value(value) {} \
+ void dump(PrintStream& out) const { function(out, m_value); } \
+ \
+ private: \
+ Type m_value; \
+ }
+
+#define MAKE_PRINT_METHOD_ADAPTOR(Name, Type, method) \
+ class Name final { \
+ STACK_ALLOCATED(); \
+ \
+ public: \
+ Name(const Type& value) : m_value(value) {} \
+ void dump(PrintStream& out) const { m_value.method(out); } \
+ \
+ private: \
+ const Type& m_value; \
+ }
+
+#define MAKE_PRINT_METHOD(Type, dumpMethod, method) \
+ MAKE_PRINT_METHOD_ADAPTOR(DumperFor_##method, Type, dumpMethod); \
+ DumperFor_##method method() const { return DumperFor_##method(*this); }
// Use an adaptor-based dumper for characters to avoid situations where
// you've "compressed" an integer to a character and it ends up printing
@@ -130,34 +128,32 @@ MAKE_PRINT_ADAPTOR(CharacterDump, char, dumpCharacter);
template <typename T>
class PointerDump final {
- STACK_ALLOCATED();
-public:
- PointerDump(const T* ptr)
- : m_ptr(ptr)
- {
- }
-
- void dump(PrintStream& out) const
- {
- if (m_ptr)
- printInternal(out, *m_ptr);
- else
- out.print("(null)");
- }
-
-private:
- const T* m_ptr;
+ STACK_ALLOCATED();
+
+ public:
+ PointerDump(const T* ptr) : m_ptr(ptr) {}
+
+ void dump(PrintStream& out) const {
+ if (m_ptr)
+ printInternal(out, *m_ptr);
+ else
+ out.print("(null)");
+ }
+
+ private:
+ const T* m_ptr;
};
template <typename T>
-PointerDump<T> pointerDump(const T* ptr) { return PointerDump<T>(ptr); }
+PointerDump<T> pointerDump(const T* ptr) {
+ return PointerDump<T>(ptr);
+}
-} // namespace WTF
+} // namespace WTF
using WTF::CharacterDump;
using WTF::PointerDump;
using WTF::PrintStream;
using WTF::pointerDump;
-#endif // PrintStream_h
-
+#endif // PrintStream_h
« no previous file with comments | « third_party/WebKit/Source/wtf/PassRefPtr.h ('k') | third_party/WebKit/Source/wtf/PrintStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698