Commit 599b1a12 authored by abarth@chromium.org's avatar abarth@chromium.org

Delete ASSERT_DISABLED

ASSERT_ENABLED doens't have more not double negatives.

Note the #ifndef ASSERT_DISABLED in DatabaseThread.cpp was always compiled out
because ASSERT_DISABLED was always defined to be either 0 or 1.

Review URL: https://codereview.chromium.org/331793004

git-svn-id: svn://svn.chromium.org/blink/trunk@176120 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e3e905ce
......@@ -53,11 +53,7 @@ public:
#define IGNORE_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis())
#if ASSERT_DISABLED
#define ASSERT_NO_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis())
#else
#if ASSERT_ENABLED
class NoExceptionStateAssertionChecker FINAL : public ExceptionState {
public:
......@@ -74,6 +70,10 @@ private:
#define ASSERT_NO_EXCEPTION (::WebCore::NoExceptionStateAssertionChecker(__FILE__, __LINE__).returnThis())
#else
#define ASSERT_NO_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis())
#endif
} // namespace WebCore
......
......@@ -235,7 +235,7 @@ void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, Element
{
const ActiveAnimations* activeAnimations = element ? element->activeAnimations() : 0;
#if ASSERT_DISABLED
#if !ASSERT_ENABLED
// If we're in an animation style change, no animations can have started, been cancelled or changed play state.
// When ASSERT is enabled, we verify this optimization.
if (activeAnimations && activeAnimations->isAnimationStyleChange())
......@@ -459,12 +459,12 @@ void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
const TransitionMap* activeTransitions = activeAnimations ? &activeAnimations->cssAnimations().m_transitions : 0;
const CSSTransitionData* transitionData = style.transitions();
#if ASSERT_DISABLED
// In release builds we avoid the cost of checking for new and interrupted transitions if the style recalc is due to animation.
const bool animationStyleRecalc = activeAnimations && activeAnimations->isAnimationStyleChange();
#else
#if ASSERT_ENABLED
// In debug builds we verify that it would have been safe to avoid populating and testing listedProperties if the style recalc is due to animation.
const bool animationStyleRecalc = false;
#else
// In release builds we avoid the cost of checking for new and interrupted transitions if the style recalc is due to animation.
const bool animationStyleRecalc = activeAnimations && activeAnimations->isAnimationStyleChange();
#endif
BitArray<numCSSProperties> listedProperties;
......
......@@ -5,23 +5,12 @@
#ifndef ScriptForbiddenScope_h
#define ScriptForbiddenScope_h
#include "wtf/Assertions.h"
#include "wtf/TemporaryChange.h"
namespace WebCore {
#if ASSERT_DISABLED
class ScriptForbiddenScope {
public:
ScriptForbiddenScope() { }
class AllowUserAgentScript {
public:
AllowUserAgentScript() { }
};
static bool isScriptForbidden() { return false; }
};
#else
#if ASSERT_ENABLED
class ScriptForbiddenScope {
public:
......@@ -39,6 +28,18 @@ public:
static bool isScriptForbidden();
};
#else
class ScriptForbiddenScope {
public:
ScriptForbiddenScope() { }
class AllowUserAgentScript {
public:
AllowUserAgentScript() { }
};
static bool isScriptForbidden() { return false; }
};
#endif
} // namespace WebCore
......
......@@ -156,7 +156,7 @@ class Capitalizer:
ABBREVIATION = frozenset(["XHR", "DOM", "CSS"])
VALIDATOR_IFDEF_NAME = "!ASSERT_DISABLED"
VALIDATOR_IFDEF_NAME = "ASSERT_ENABLED"
class DomainNameFixes:
......
......@@ -227,10 +227,10 @@ protected:
private:
void initGroup();
#if ASSERT_DISABLED
void checkSubframeCountConsistency() const { }
#else
#if ASSERT_ENABLED
void checkSubframeCountConsistency() const;
#else
void checkSubframeCountConsistency() const { }
#endif
void setTimerAlignmentInterval(double);
......
......@@ -147,9 +147,6 @@ void DatabaseThread::recordDatabaseOpen(DatabaseBackend* database)
void DatabaseThread::recordDatabaseClosed(DatabaseBackend* database)
{
#ifndef ASSERT_DISABLED
MutexLocker lock(m_terminationRequestedMutex);
#endif
ASSERT(isDatabaseThread());
ASSERT(database);
ASSERT(m_terminationRequested || m_openDatabaseSet.contains(database));
......
......@@ -30,9 +30,9 @@
void ReportBlockedObjCException(NSException *exception)
{
#if ASSERT_DISABLED
NSLog(@"*** WebKit discarding exception: <%@> %@", [exception name], [exception reason]);
#else
#if ASSERT_ENABLED
ASSERT_WITH_MESSAGE(0, "Uncaught exception - %@", exception);
#else
NSLog(@"*** WebKit discarding exception: <%@> %@", [exception name], [exception reason]);
#endif
}
......@@ -54,10 +54,10 @@
#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT
#endif
#ifndef ASSERT_DISABLED
#define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT
#ifndef ASSERT_ENABLED
// Notice the not below:
#define ASSERT_ENABLED !ASSERTIONS_DISABLED_DEFAULT
#endif
#define ASSERT_ENABLED !ASSERT_DISABLED
#ifndef ASSERT_MSG_DISABLED
#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT
......@@ -179,16 +179,7 @@ WTF_EXPORT void WTFInstallReportBacktraceOnCrashHook();
#undef ASSERT
#endif
#if ASSERT_DISABLED
#define ASSERT(assertion) ((void)0)
#define ASSERT_AT(assertion, file, line, function) ((void)0)
#define ASSERT_NOT_REACHED() ((void)0)
#define NO_RETURN_DUE_TO_ASSERT
#define ASSERT_UNUSED(variable, assertion) ((void)variable)
#else
#if ASSERT_ENABLED
#define ASSERT(assertion) \
(!(assertion) ? \
......@@ -211,6 +202,15 @@ WTF_EXPORT void WTFInstallReportBacktraceOnCrashHook();
#define NO_RETURN_DUE_TO_ASSERT NO_RETURN_DUE_TO_CRASH
#else
#define ASSERT(assertion) ((void)0)
#define ASSERT_AT(assertion, file, line, function) ((void)0)
#define ASSERT_NOT_REACHED() ((void)0)
#define NO_RETURN_DUE_TO_ASSERT
#define ASSERT_UNUSED(variable, assertion) ((void)variable)
#endif
/* ASSERT_WITH_SECURITY_IMPLICATION / RELEASE_ASSERT_WITH_SECURITY_IMPLICATION
......@@ -352,14 +352,14 @@ static inline void UNREACHABLE_FOR_PLATFORM()
http://code.google.com/p/chromium/issues/entry?template=Security%20Bug
*/
#if ASSERT_DISABLED
#define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH()) : (void)0)
#define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion)
#define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH()
#else
#if ASSERT_ENABLED
#define RELEASE_ASSERT(assertion) ASSERT(assertion)
#define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertion, __VA_ARGS__)
#define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED()
#else
#define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH()) : (void)0)
#define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion)
#define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH()
#endif
/* DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment