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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2327643003: Replace ASSERT*() with DCHECK*() in core/fetch/ and core/loader/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT_UNUSED Created 4 years, 3 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
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 9271ff3424ae4c4d85ef0c0b2bd035d2808f6228..3c7731d280415105421b4617f699038176c6c4e5 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -137,7 +137,7 @@ void Resource::CachedMetadataHandlerImpl::setCachedMetadata(uint32_t dataTypeID,
// Currently, only one type of cached metadata per resource is supported.
// If the need arises for multiple types of metadata per resource this could
// be enhanced to store types of metadata in a map.
- ASSERT(!m_cachedMetadata);
+ DCHECK(!m_cachedMetadata);
m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size);
if (cacheType == CachedMetadataHandler::SendToPlatform)
sendToPlatform();
@@ -167,7 +167,7 @@ void Resource::CachedMetadataHandlerImpl::setSerializedCachedMetadata(const char
// We only expect to receive cached metadata from the platform once.
// If this triggers, it indicates an efficiency problem which is most
// likely unexpected in code designed to improve performance.
- ASSERT(!m_cachedMetadata);
+ DCHECK(!m_cachedMetadata);
m_cachedMetadata = CachedMetadata::createFromSerializedData(data, size);
}
@@ -306,7 +306,7 @@ Resource::Resource(const ResourceRequest& request, Type type, const ResourceLoad
, m_cancelTimer(this, &Resource::cancelTimerFired)
, m_resourceRequest(request)
{
- ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests careless updates of the enum.
+ DCHECK(m_type == unsigned(type)); // m_type is a bitfield, so this tests careless updates of the enum.
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter);
// Currently we support the metadata caching only for HTTP family.
@@ -332,8 +332,8 @@ DEFINE_TRACE(Resource)
void Resource::setLoader(ResourceLoader* loader)
{
- RELEASE_ASSERT(!m_loader);
- ASSERT(stillNeedsLoad());
+ CHECK(!m_loader);
+ DCHECK(stillNeedsLoad());
m_loader = loader;
m_status = Pending;
}
@@ -368,7 +368,7 @@ void Resource::appendData(const char* data, size_t length)
{
TRACE_EVENT0("blink", "Resource::appendData");
DCHECK(!m_isRevalidating);
- ASSERT(!errorOccurred());
+ DCHECK(!errorOccurred());
if (m_options.dataBufferingPolicy == DoNotBufferData)
return;
if (m_data)
@@ -381,8 +381,8 @@ void Resource::appendData(const char* data, size_t length)
void Resource::setResourceBuffer(PassRefPtr<SharedBuffer> resourceBuffer)
{
DCHECK(!m_isRevalidating);
- ASSERT(!errorOccurred());
- ASSERT(m_options.dataBufferingPolicy == BufferData);
+ DCHECK(!errorOccurred());
+ DCHECK(m_options.dataBufferingPolicy == BufferData);
yhirano 2016/09/12 04:33:11 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
m_data = resourceBuffer;
setEncodedSize(m_data->size());
}
@@ -396,7 +396,7 @@ void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy)
void Resource::error(const ResourceError& error)
{
- ASSERT(!error.isNull());
+ DCHECK(!error.isNull());
m_error = error;
m_isRevalidating = false;
@@ -405,7 +405,7 @@ void Resource::error(const ResourceError& error)
if (!errorOccurred())
setStatus(LoadError);
- ASSERT(errorOccurred());
+ DCHECK(errorOccurred());
m_data.clear();
m_loader = nullptr;
checkNotify();
@@ -580,7 +580,7 @@ void Resource::responseReceived(const ResourceResponse& response, std::unique_pt
void Resource::setSerializedCachedMetadata(const char* data, size_t size)
{
DCHECK(!m_isRevalidating);
- ASSERT(!m_response.isNull());
+ DCHECK(!m_response.isNull());
if (m_cacheHandler)
m_cacheHandler->setSerializedCachedMetadata(data, size);
}
@@ -751,7 +751,8 @@ void Resource::allClientsAndObserversRemoved()
void Resource::cancelTimerFired(TimerBase* timer)
{
- ASSERT_UNUSED(timer, timer == &m_cancelTimer);
+ ALLOW_UNUSED_LOCAL(timer);
yhirano 2016/09/12 04:33:12 Is this needed? DCHECK requires its expectation as
hiroshige 2016/09/13 08:43:19 I put ALLOW_UNUSED_LOCAL() based on a comment in A
tkent 2016/09/13 08:50:52 AFAIK we don't need to add ALLOW_UNUSED_LOCAL() on
hiroshige 2016/09/13 09:30:51 Thanks! I'll create a separate CL to fix Assertion
+ DCHECK(timer == &m_cancelTimer);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
if (!hasClientsOrObservers() && m_loader)
m_loader->cancel();
}
@@ -810,7 +811,7 @@ void Resource::finishPendingClients()
ResourceCallback::callbackHandler().cancel(this);
// Prevent the case when there are clients waiting but no callback scheduled.
- ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled);
+ DCHECK(m_clientsAwaitingCallback.isEmpty() || scheduled);
}
void Resource::prune()
@@ -1039,7 +1040,7 @@ const char* Resource::resourceTypeToString(Type type, const FetchInitiatorInfo&
case Resource::Manifest:
return "Manifest";
}
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return initatorTypeNameToString(initiatorInfo.name);
}
@@ -1067,7 +1068,7 @@ bool Resource::isLoadEventBlockingResourceType() const
case Resource::Manifest:
return false;
}
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698