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

Side by Side Diff: base/mac/mac_logging.h

Issue 278923002: Use the new ScopedMachVM class and the MACH_LOG family of logging macros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto r269793 Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gypi ('k') | base/mac/mach_logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MAC_MAC_LOGGING_H_ 5 #ifndef BASE_MAC_MAC_LOGGING_H_
6 #define BASE_MAC_MAC_LOGGING_H_ 6 #define BASE_MAC_MAC_LOGGING_H_
7 7
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "build/build_config.h" 11 #include "build/build_config.h"
10 12
11 #if defined(OS_IOS) 13 #if defined(OS_IOS)
12 #include <MacTypes.h> 14 #include <MacTypes.h>
13 #else 15 #else
14 #include <libkern/OSTypes.h> 16 #include <libkern/OSTypes.h>
15 #endif 17 #endif
16 18
17 // Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X 19 // Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X
(...skipping 18 matching lines...) Expand all
36 ~OSStatusLogMessage(); 38 ~OSStatusLogMessage();
37 39
38 private: 40 private:
39 OSStatus status_; 41 OSStatus status_;
40 42
41 DISALLOW_COPY_AND_ASSIGN(OSStatusLogMessage); 43 DISALLOW_COPY_AND_ASSIGN(OSStatusLogMessage);
42 }; 44 };
43 45
44 } // namespace logging 46 } // namespace logging
45 47
48 #if defined(NDEBUG)
49 #define MAC_DVLOG_IS_ON(verbose_level) 0
50 #else
51 #define MAC_DVLOG_IS_ON(verbose_level) VLOG_IS_ON(verbose_level)
52 #endif
53
46 #define OSSTATUS_LOG_STREAM(severity, status) \ 54 #define OSSTATUS_LOG_STREAM(severity, status) \
47 COMPACT_GOOGLE_LOG_EX_ ## severity(OSStatusLogMessage, status).stream() 55 COMPACT_GOOGLE_LOG_EX_ ## severity(OSStatusLogMessage, status).stream()
48 #define OSSTATUS_VLOG_STREAM(verbose_level, status) \ 56 #define OSSTATUS_VLOG_STREAM(verbose_level, status) \
49 logging::OSStatusLogMessage(__FILE__, __LINE__, \ 57 logging::OSStatusLogMessage(__FILE__, __LINE__, \
50 -verbose_level, status).stream() 58 -verbose_level, status).stream()
51 59
52 #define OSSTATUS_LOG(severity, status) \ 60 #define OSSTATUS_LOG(severity, status) \
53 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), LOG_IS_ON(severity)) 61 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), LOG_IS_ON(severity))
54 #define OSSTATUS_LOG_IF(severity, condition, status) \ 62 #define OSSTATUS_LOG_IF(severity, condition, status) \
55 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \ 63 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
(...skipping 11 matching lines...) Expand all
67 << "Check failed: " # condition << ". " 75 << "Check failed: " # condition << ". "
68 76
69 #define OSSTATUS_DLOG(severity, status) \ 77 #define OSSTATUS_DLOG(severity, status) \
70 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), DLOG_IS_ON(severity)) 78 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), DLOG_IS_ON(severity))
71 #define OSSTATUS_DLOG_IF(severity, condition, status) \ 79 #define OSSTATUS_DLOG_IF(severity, condition, status) \
72 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \ 80 LAZY_STREAM(OSSTATUS_LOG_STREAM(severity, status), \
73 DLOG_IS_ON(severity) && (condition)) 81 DLOG_IS_ON(severity) && (condition))
74 82
75 #define OSSTATUS_DVLOG(verbose_level, status) \ 83 #define OSSTATUS_DVLOG(verbose_level, status) \
76 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \ 84 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
77 DVLOG_IS_ON(verbose_level)) 85 MAC_DVLOG_IS_ON(verbose_level))
78 #define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \ 86 #define OSSTATUS_DVLOG_IF(verbose_level, condition, status) \
79 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status) \ 87 LAZY_STREAM(OSSTATUS_VLOG_STREAM(verbose_level, status), \
80 DVLOG_IS_ON(verbose_level) && (condition)) 88 MAC_DVLOG_IS_ON(verbose_level) && (condition))
81 89
82 #define OSSTATUS_DCHECK(condition, status) \ 90 #define OSSTATUS_DCHECK(condition, status) \
83 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \ 91 LAZY_STREAM(OSSTATUS_LOG_STREAM(FATAL, status), \
84 DCHECK_IS_ON && !(condition)) \ 92 DCHECK_IS_ON && !(condition)) \
85 << "Check failed: " # condition << ". " 93 << "Check failed: " # condition << ". "
86 94
87 #endif // BASE_MAC_MAC_LOGGING_H_ 95 #endif // BASE_MAC_MAC_LOGGING_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/mac/mach_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698