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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/Assertions.h

Issue 2741343017: Move files in wtf/ to platform/wtf/ (Part 4). (Closed)
Patch Set: Rebase. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 // This file uses some GCC extensions, but it should be compatible with C++ and 30 // This file uses some GCC extensions, but it should be compatible with C++ and
31 // Objective C++. 31 // Objective C++.
32 // 32 //
33 // For non-debug builds, everything is disabled by default, except for the 33 // For non-debug builds, everything is disabled by default, except for the
34 // RELEASE_ASSERT family of macros. 34 // RELEASE_ASSERT family of macros.
35 35
36 #include <stdarg.h> 36 #include <stdarg.h>
37 #include "base/allocator/partition_allocator/oom.h" 37 #include "base/allocator/partition_allocator/oom.h"
38 #include "base/gtest_prod_util.h" 38 #include "base/gtest_prod_util.h"
39 #include "base/logging.h" 39 #include "base/logging.h"
40 #include "wtf/Compiler.h" 40 #include "platform/wtf/Compiler.h"
41 #include "wtf/Noncopyable.h" 41 #include "platform/wtf/Noncopyable.h"
42 #include "wtf/WTFExport.h" 42 #include "platform/wtf/WTFExport.h"
43 #include "wtf/build_config.h" 43 #include "platform/wtf/build_config.h"
44 44
45 #if OS(WIN) 45 #if OS(WIN)
46 #include <windows.h> 46 #include <windows.h>
47 #endif 47 #endif
48 48
49 #ifndef LOG_DISABLED 49 #ifndef LOG_DISABLED
50 #define LOG_DISABLED !DCHECK_IS_ON() 50 #define LOG_DISABLED !DCHECK_IS_ON()
51 #endif 51 #endif
52 52
53 // WTFLogAlways() is deprecated. crbug.com/638849 53 // WTFLogAlways() is deprecated. crbug.com/638849
54 WTF_EXPORT PRINTF_FORMAT(1, 2) void WTFLogAlways(const char* format, ...); 54 WTF_EXPORT PRINTF_FORMAT(1, 2) // NOLINT
55 void WTFLogAlways(const char* format, ...);
55 56
56 namespace WTF { 57 namespace WTF {
57 58
58 #if LOG_DISABLED 59 #if LOG_DISABLED
59 60
60 #define WTF_CREATE_SCOPED_LOGGER(...) ((void)0) 61 #define WTF_CREATE_SCOPED_LOGGER(...) ((void)0)
61 #define WTF_CREATE_SCOPED_LOGGER_IF(...) ((void)0) 62 #define WTF_CREATE_SCOPED_LOGGER_IF(...) ((void)0)
62 #define WTF_APPEND_SCOPED_LOGGER(...) ((void)0) 63 #define WTF_APPEND_SCOPED_LOGGER(...) ((void)0)
63 64
64 #else 65 #else
(...skipping 12 matching lines...) Expand all
77 // The first message is passed to the constructor. Additional messages for 78 // The first message is passed to the constructor. Additional messages for
78 // the same scope can be added with log(). If condition is false, produce no 79 // the same scope can be added with log(). If condition is false, produce no
79 // output and do not create a scope. 80 // output and do not create a scope.
80 PRINTF_FORMAT(3, 4) ScopedLogger(bool condition, const char* format, ...); 81 PRINTF_FORMAT(3, 4) ScopedLogger(bool condition, const char* format, ...);
81 ~ScopedLogger(); 82 ~ScopedLogger();
82 PRINTF_FORMAT(2, 3) void log(const char* format, ...); 83 PRINTF_FORMAT(2, 3) void log(const char* format, ...);
83 84
84 private: 85 private:
85 FRIEND_TEST_ALL_PREFIXES(AssertionsTest, ScopedLogger); 86 FRIEND_TEST_ALL_PREFIXES(AssertionsTest, ScopedLogger);
86 using PrintFunctionPtr = void (*)(const char* format, va_list args); 87 using PrintFunctionPtr = void (*)(const char* format, va_list args);
87 static void setPrintFuncForTests(PrintFunctionPtr p) { 88
88 m_printFunc = p; 89 // Note: not thread safe.
89 } // Note: not thread safe. 90 static void setPrintFuncForTests(PrintFunctionPtr);
90 91
91 void init(const char* format, va_list args); 92 void init(const char* format, va_list args);
92 void writeNewlineIfNeeded(); 93 void writeNewlineIfNeeded();
93 void indent(); 94 void indent();
94 void print(const char* format, ...); 95 void print(const char* format, ...);
95 void printIndent(); 96 void printIndent();
96 static ScopedLogger*& current(); 97 static ScopedLogger*& current();
97 98
98 ScopedLogger* const m_parent; 99 ScopedLogger* const m_parent;
99 bool m_multiline; // The ')' will go on the same line if there is only one 100 bool m_multiline; // The ')' will go on the same line if there is only one
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return static_cast<thisType&>(argument); \ 250 return static_cast<thisType&>(argument); \
250 } \ 251 } \
251 inline const thisType& to##thisType##OrDie(const argumentType& argument) { \ 252 inline const thisType& to##thisType##OrDie(const argumentType& argument) { \
252 CHECK(referencePredicate); \ 253 CHECK(referencePredicate); \
253 return static_cast<const thisType&>(argument); \ 254 return static_cast<const thisType&>(argument); \
254 } \ 255 } \
255 void to##thisType##OrDie(const thisType*); \ 256 void to##thisType##OrDie(const thisType*); \
256 void to##thisType##OrDie(const thisType&) 257 void to##thisType##OrDie(const thisType&)
257 258
258 #endif // WTF_Assertions_h 259 #endif // WTF_Assertions_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/ASCIICType.cpp ('k') | third_party/WebKit/Source/platform/wtf/Atomics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698