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

Unified Diff: base/mac/mach_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/mac_logging.h ('k') | base/mac/mach_logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/mach_logging.h
diff --git a/base/mac/mach_logging.h b/base/mac/mach_logging.h
index 589dde20173de9f99591a13aaf8088a40b7c0364..a9b3b65d6482b32e4e9c32478bffc24f017f4a54 100644
--- a/base/mac/mach_logging.h
+++ b/base/mac/mach_logging.h
@@ -7,8 +7,10 @@
#include <mach/mach.h>
+#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/logging.h"
+#include "build/build_config.h"
// Use the MACH_LOG family of macros along with a mach_error_t (kern_return_t)
// containing a Mach error. The error value will be decoded so that logged
@@ -26,12 +28,12 @@
// MACH_LOG(ERROR, kr) << "mach_timebase_info";
// }
//
-// kr = mach_vm_deallocate(task, address, size);
-// MACH_DCHECK(kr == KERN_SUCCESS, kr) << "mach_vm_deallocate";
+// kr = vm_deallocate(task, address, size);
+// MACH_DCHECK(kr == KERN_SUCCESS, kr) << "vm_deallocate";
namespace logging {
-class MachLogMessage : public logging::LogMessage {
+class BASE_EXPORT MachLogMessage : public logging::LogMessage {
public:
MachLogMessage(const char* file_path,
int line,
@@ -45,22 +47,14 @@ class MachLogMessage : public logging::LogMessage {
DISALLOW_COPY_AND_ASSIGN(MachLogMessage);
};
-class BootstrapLogMessage : public logging::LogMessage {
- public:
- BootstrapLogMessage(const char* file_path,
- int line,
- LogSeverity severity,
- kern_return_t bootstrap_err);
- ~BootstrapLogMessage();
-
- private:
- kern_return_t bootstrap_err_;
-
- DISALLOW_COPY_AND_ASSIGN(BootstrapLogMessage);
-};
-
} // namespace logging
+#if defined(NDEBUG)
+#define MACH_DVLOG_IS_ON(verbose_level) 0
+#else
+#define MACH_DVLOG_IS_ON(verbose_level) VLOG_IS_ON(verbose_level)
+#endif
+
#define MACH_LOG_STREAM(severity, mach_err) \
COMPACT_GOOGLE_LOG_EX_ ## severity(MachLogMessage, mach_err).stream()
#define MACH_VLOG_STREAM(verbose_level, mach_err) \
@@ -92,16 +86,38 @@ class BootstrapLogMessage : public logging::LogMessage {
#define MACH_DVLOG(verbose_level, mach_err) \
LAZY_STREAM(MACH_VLOG_STREAM(verbose_level, mach_err), \
- DVLOG_IS_ON(verbose_level))
+ MACH_DVLOG_IS_ON(verbose_level))
#define MACH_DVLOG_IF(verbose_level, condition, mach_err) \
- LAZY_STREAM(MACH_VLOG_STREAM(verbose_level, mach_err) \
- DVLOG_IS_ON(verbose_level) && (condition))
+ LAZY_STREAM(MACH_VLOG_STREAM(verbose_level, mach_err), \
+ MACH_DVLOG_IS_ON(verbose_level) && (condition))
#define MACH_DCHECK(condition, mach_err) \
LAZY_STREAM(MACH_LOG_STREAM(FATAL, mach_err), \
DCHECK_IS_ON && !(condition)) \
<< "Check failed: " # condition << ". "
+#if !defined(OS_IOS)
+
+namespace logging {
+
+class BASE_EXPORT BootstrapLogMessage : public logging::LogMessage {
+ public:
+ BootstrapLogMessage(const char* file_path,
+ int line,
+ LogSeverity severity,
+ kern_return_t bootstrap_err);
+ ~BootstrapLogMessage();
+
+ private:
+ kern_return_t bootstrap_err_;
+
+ DISALLOW_COPY_AND_ASSIGN(BootstrapLogMessage);
+};
+
+} // namespace logging
+
+#define BOOTSTRAP_DVLOG_IS_ON MACH_DVLOG_IS_ON
+
#define BOOTSTRAP_LOG_STREAM(severity, bootstrap_err) \
COMPACT_GOOGLE_LOG_EX_ ## severity(BootstrapLogMessage, \
bootstrap_err).stream()
@@ -136,14 +152,16 @@ class BootstrapLogMessage : public logging::LogMessage {
#define BOOTSTRAP_DVLOG(verbose_level, bootstrap_err) \
LAZY_STREAM(BOOTSTRAP_VLOG_STREAM(verbose_level, bootstrap_err), \
- DVLOG_IS_ON(verbose_level))
+ BOOTSTRAP_DVLOG_IS_ON(verbose_level))
#define BOOTSTRAP_DVLOG_IF(verbose_level, condition, bootstrap_err) \
- LAZY_STREAM(BOOTSTRAP_VLOG_STREAM(verbose_level, bootstrap_err) \
- DVLOG_IS_ON(verbose_level) && (condition))
+ LAZY_STREAM(BOOTSTRAP_VLOG_STREAM(verbose_level, bootstrap_err), \
+ BOOTSTRAP_DVLOG_IS_ON(verbose_level) && (condition))
#define BOOTSTRAP_DCHECK(condition, bootstrap_err) \
LAZY_STREAM(BOOTSTRAP_LOG_STREAM(FATAL, bootstrap_err), \
DCHECK_IS_ON && !(condition)) \
<< "Check failed: " # condition << ". "
+#endif // !OS_IOS
+
#endif // BASE_MAC_MACH_LOGGING_H_
« no previous file with comments | « base/mac/mac_logging.h ('k') | base/mac/mach_logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698