Commit dc46f058 authored by pilgrim's avatar pilgrim Committed by Commit bot

Replace remaining ASSERT with DCHECK/_EQ as appropriate

BUG=596760
TBR=mkwst

Review-Url: https://codereview.chromium.org/2896443003
Cr-Commit-Position: refs/heads/master@{#473792}
parent f010d72f
...@@ -94,7 +94,8 @@ const Value* FindValue(const char* str, unsigned int len) { ...@@ -94,7 +94,8 @@ const Value* FindValue(const char* str, unsigned int len) {
} }
const char* getValueName(CSSValueID id) { const char* getValueName(CSSValueID id) {
ASSERT(id > 0 && id < numCSSValueKeywords); DCHECK_GT(id, 0);
DCHECK_LT(id, numCSSValueKeywords);
return valueListStringPool + valueListStringOffsets[id - 1]; return valueListStringPool + valueListStringOffsets[id - 1];
} }
......
...@@ -54,7 +54,7 @@ struct Create{{namespace}}FunctionMapData { ...@@ -54,7 +54,7 @@ struct Create{{namespace}}FunctionMapData {
}; };
static void create{{namespace}}FunctionMap() { static void create{{namespace}}FunctionMap() {
ASSERT(!g_constructors); DCHECK(!g_constructors);
g_constructors = new FunctionMap; g_constructors = new FunctionMap;
// Empty array initializer lists are illegal [dcl.init.aggr] and will not // Empty array initializer lists are illegal [dcl.init.aggr] and will not
// compile in MSVC. If tags list is empty, add check to skip this. // compile in MSVC. If tags list is empty, add check to skip this.
......
...@@ -33,7 +33,8 @@ void StyleBuilder::ApplyProperty(CSSPropertyID property, ...@@ -33,7 +33,8 @@ void StyleBuilder::ApplyProperty(CSSPropertyID property,
{% endfor %} {% endfor %}
case CSSPropertyVariable: case CSSPropertyVariable:
ASSERT(!isInitial && !isInherit); DCHECK(!isInitial);
DCHECK(!isInherit);
StyleBuilderFunctions::applyValueCSSPropertyVariable(state, value); StyleBuilderFunctions::applyValueCSSPropertyVariable(state, value);
return; return;
{% for property_id, property in properties.items() if property.direction_aware %} {% for property_id, property in properties.items() if property.direction_aware %}
......
...@@ -58,7 +58,7 @@ const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID) { ...@@ -58,7 +58,7 @@ const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID) {
void getMatchingShorthandsForLonghand( void getMatchingShorthandsForLonghand(
CSSPropertyID propertyID, Vector<StylePropertyShorthand, 4>* result) { CSSPropertyID propertyID, Vector<StylePropertyShorthand, 4>* result) {
ASSERT(!result->size()); DCHECK(!result->size());
switch (propertyID) { switch (propertyID) {
{% for longhand_id, shorthands in longhands_dictionary.items() %} {% for longhand_id, shorthands in longhands_dictionary.items() %}
case {{longhand_id}}: { case {{longhand_id}}: {
......
...@@ -989,7 +989,7 @@ void HTMLDocumentParser::EndIfDelayed() { ...@@ -989,7 +989,7 @@ void HTMLDocumentParser::EndIfDelayed() {
} }
void HTMLDocumentParser::Finish() { void HTMLDocumentParser::Finish() {
// FIXME: We should ASSERT(!m_parserStopped) here, since it does not makes // FIXME: We should DCHECK(!m_parserStopped) here, since it does not makes
// sense to call any methods on DocumentParser once it's been stopped. // sense to call any methods on DocumentParser once it's been stopped.
// However, FrameLoader::stop calls DocumentParser::finish unconditionally. // However, FrameLoader::stop calls DocumentParser::finish unconditionally.
......
...@@ -366,7 +366,7 @@ void TouchEventManager::UpdateTargetAndRegionMapsForTouchStarts( ...@@ -366,7 +366,7 @@ void TouchEventManager::UpdateTargetAndRegionMapsForTouchStarts(
DCHECK(touch_sequence_document_->GetFrame()->View()); DCHECK(touch_sequence_document_->GetFrame()->View());
} }
// Ideally we'd ASSERT(!m_targetForTouchID.contains(point.id()) // Ideally we'd DCHECK(!m_targetForTouchID.contains(point.id())
// since we shouldn't get a touchstart for a touch that's already // since we shouldn't get a touchstart for a touch that's already
// down. However EventSender allows this to be violated and there's // down. However EventSender allows this to be violated and there's
// some tests that take advantage of it. There may also be edge // some tests that take advantage of it. There may also be edge
...@@ -473,7 +473,7 @@ bool TouchEventManager::ReHitTestTouchPointsIfNeeded( ...@@ -473,7 +473,7 @@ bool TouchEventManager::ReHitTestTouchPointsIfNeeded(
all_touches_released = false; all_touches_released = false;
} }
if (new_touch_sequence) { if (new_touch_sequence) {
// Ideally we'd ASSERT(!m_touchSequenceDocument) here since we should // Ideally we'd DCHECK(!m_touchSequenceDocument) here since we should
// have cleared the active document when we saw the last release. But we // have cleared the active document when we saw the last release. But we
// have some tests that violate this, ClusterFuzz could trigger it, and // have some tests that violate this, ClusterFuzz could trigger it, and
// there may be cases where the browser doesn't reliably release all // there may be cases where the browser doesn't reliably release all
......
...@@ -20,17 +20,16 @@ ...@@ -20,17 +20,16 @@
namespace blink { namespace blink {
#define DEFINE_STATIC_LOCAL_WITH_LOCK(type, name, arguments) \
ASSERT(IsolatesMutex().Locked()); \
static type& name = *new type arguments
static Mutex& IsolatesMutex() { static Mutex& IsolatesMutex() {
DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex);
return mutex; return mutex;
} }
static HashSet<v8::Isolate*>& Isolates() { static HashSet<v8::Isolate*>& Isolates() {
DEFINE_STATIC_LOCAL_WITH_LOCK(HashSet<v8::Isolate*>, isolates, ()); #if DCHECK_IS_ON()
DCHECK(IsolatesMutex().Locked());
#endif
static HashSet<v8::Isolate*>& isolates = *new HashSet<v8::Isolate*>();
return isolates; return isolates;
} }
......
...@@ -180,7 +180,9 @@ bool LookupAlgorithmIdByName(const String& algorithm_name, ...@@ -180,7 +180,9 @@ bool LookupAlgorithmIdByName(const String& algorithm_name,
const AlgorithmNameMapping* end = const AlgorithmNameMapping* end =
kAlgorithmNameMappings + WTF_ARRAY_LENGTH(kAlgorithmNameMappings); kAlgorithmNameMappings + WTF_ARRAY_LENGTH(kAlgorithmNameMappings);
ASSERT(VerifyAlgorithmNameMappings(begin, end)); #if DCHECK_IS_ON()
DCHECK(VerifyAlgorithmNameMappings(begin, end));
#endif
const AlgorithmNameMapping* it; const AlgorithmNameMapping* it;
if (algorithm_name.Impl()->Is8Bit()) if (algorithm_name.Impl()->Is8Bit())
......
...@@ -37,7 +37,7 @@ struct StructTraits<blink::mojom::ReferrerDataView, blink::Referrer> { ...@@ -37,7 +37,7 @@ struct StructTraits<blink::mojom::ReferrerDataView, blink::Referrer> {
static_cast<blink::ReferrerPolicy>(webReferrerPolicy); static_cast<blink::ReferrerPolicy>(webReferrerPolicy);
out->referrer = AtomicString(referrer.GetString()); out->referrer = AtomicString(referrer.GetString());
// Mimics the ASSERT() done in the blink::Referrer constructor. // Mimics the DCHECK() done in the blink::Referrer constructor.
return referrer.IsValid() || out->referrer == blink::Referrer::NoReferrer(); return referrer.IsValid() || out->referrer == blink::Referrer::NoReferrer();
} }
}; };
......
...@@ -833,7 +833,7 @@ bool KURL::ProtocolIs(const StringView protocol) const { ...@@ -833,7 +833,7 @@ bool KURL::ProtocolIs(const StringView protocol) const {
// they are invalid. The free function protocolIsJavaScript() should be used // they are invalid. The free function protocolIsJavaScript() should be used
// instead. // instead.
// FIXME: Chromium code needs to be fixed for this assert to be enabled. // FIXME: Chromium code needs to be fixed for this assert to be enabled.
// ASSERT(strcmp(protocol, "javascript")); // DCHECK(strcmp(protocol, "javascript"));
return protocol_ == protocol; return protocol_ == protocol;
} }
......
...@@ -558,7 +558,7 @@ void WebDevToolsAgentImpl::SendProtocolMessage(int session_id, ...@@ -558,7 +558,7 @@ void WebDevToolsAgentImpl::SendProtocolMessage(int session_id,
int call_id, int call_id,
const String& response, const String& response,
const String& state) { const String& state) {
ASSERT(Attached()); DCHECK(Attached());
if (client_) if (client_)
client_->SendProtocolMessage(session_id, call_id, response, state); client_->SendProtocolMessage(session_id, call_id, response, state);
} }
......
...@@ -18,7 +18,7 @@ static SimNetwork* g_network = nullptr; ...@@ -18,7 +18,7 @@ static SimNetwork* g_network = nullptr;
SimNetwork::SimNetwork() : current_request_(nullptr) { SimNetwork::SimNetwork() : current_request_(nullptr) {
Platform::Current()->GetURLLoaderMockFactory()->SetLoaderDelegate(this); Platform::Current()->GetURLLoaderMockFactory()->SetLoaderDelegate(this);
ASSERT(!g_network); DCHECK(!g_network);
g_network = this; g_network = this;
} }
......
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