summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 01:20:29 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 01:20:29 +0000
commite3cca33f0cc65e22cbc5bfc5baa1a3fabd2977cb (patch)
tree3c81cd6986539b9cf6ffd63627c2cce8471d0b50 /base
parentf968e381c3fba13202b44c63abfbda0f29f1c001 (diff)
downloadchromium_src-e3cca33f0cc65e22cbc5bfc5baa1a3fabd2977cb.zip
chromium_src-e3cca33f0cc65e22cbc5bfc5baa1a3fabd2977cb.tar.gz
chromium_src-e3cca33f0cc65e22cbc5bfc5baa1a3fabd2977cb.tar.bz2
Omit DLOGs and DCHECKs from release-mode Google Chrome-branded builds on
non-Windows. They were previously omitted on Windows official builds only. BUG=16512 TEST=DCHECK logging unavailable in official builds; Mac .app shrinks by about 740kB; Mac .dmg shrinks by about 315kB; Linux binary and package shrink by similar amounts Review URL: http://codereview.chromium.org/171093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/logging.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/base/logging.h b/base/logging.h
index db7faca..a1d439c 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -280,9 +280,17 @@ std::string* MakeCheckOpString(const int& v1,
// foo.CheckThatFoo();
// #endif
-#ifdef OFFICIAL_BUILD
-// We want to have optimized code for an official build so we remove DLOGS and
-// DCHECK from the executable.
+// http://crbug.com/16512 is open for a real fix for this. For now, Windows
+// uses OFFICIAL_BUILD and other platforms use the branding flag when NDEBUG is
+// defined.
+#if ( defined(OS_WIN) && defined(OFFICIAL_BUILD)) || \
+ (!defined(OS_WIN) && defined(NDEBUG) && defined(GOOGLE_CHROME_BUILD))
+// In order to have optimized code for official builds, remove DLOGs and
+// DCHECKs.
+#define OMIT_DLOG_AND_DCHECK 1
+#endif
+
+#ifdef OMIT_DLOG_AND_DCHECK
#define DLOG(severity) \
true ? (void) 0 : logging::LogMessageVoidify() & LOG(severity)
@@ -337,7 +345,8 @@ enum { DEBUG_MODE = 0 };
#define DCHECK_STRCASENE(str1, str2) \
while (false && (str1) == (str2)) NDEBUG_EAT_STREAM_PARAMETERS
-#else
+#else // OMIT_DLOG_AND_DCHECK
+
#ifndef NDEBUG
// On a regular debug build, we want to have DCHECKS and DLOGS enabled.
@@ -490,7 +499,8 @@ DEFINE_DCHECK_OP_IMPL(GT, > )
#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
#define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
-#endif // OFFICIAL_BUILD
+#endif // OMIT_DLOG_AND_DCHECK
+#undef OMIT_DLOG_AND_DCHECK
#define NOTREACHED() DCHECK(false)