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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.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/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index 593c806a974ebfc1e1b984e4e34c984f7b91679b..f67066c9ba707a63609aa0840d48b239aa9870e6 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -153,13 +153,13 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
, m_didRedirect(false)
, m_weakFactory(this)
{
- ASSERT(client);
+ DCHECK(client);
}
void DocumentThreadableLoader::start(const ResourceRequest& request)
{
// Setting an outgoing referer is only supported in the async code path.
- ASSERT(m_async || request.httpReferrer().isEmpty());
+ DCHECK(m_async || request.httpReferrer().isEmpty());
m_sameOriginRequest = getSecurityOrigin()->canRequestNoSuborigin(request.url());
m_requestContext = request.requestContext();
@@ -263,16 +263,16 @@ void DocumentThreadableLoader::dispatchInitialRequest(const ResourceRequest& req
return;
}
- ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl || request.isExternalRequest());
+ DCHECK(m_options.crossOriginRequestPolicy == UseAccessControl || request.isExternalRequest());
makeCrossOriginAccessRequest(request);
}
void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceRequest& request)
{
- ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl || request.isExternalRequest());
- ASSERT(m_client);
- ASSERT(!resource());
+ DCHECK(m_options.crossOriginRequestPolicy == UseAccessControl || request.isExternalRequest());
+ DCHECK(m_client);
+ DCHECK(!resource());
// Cross-origin requests are only allowed certain registered schemes.
// We would catch this when checking response headers later, but there
@@ -346,7 +346,7 @@ DocumentThreadableLoader::~DocumentThreadableLoader()
void DocumentThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds)
{
- ASSERT(m_async);
+ DCHECK(m_async);
// |m_requestStartedSeconds| == 0.0 indicates loading is already finished
// and |m_timeoutTimer| is already stopped, and thus we do nothing for such
@@ -417,9 +417,10 @@ void DocumentThreadableLoader::clear()
// the resource by calling clearResource().
void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- ASSERT(m_client);
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_async);
+ DCHECK(m_client);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_checker.redirectReceived();
@@ -441,7 +442,7 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
// We use |m_redirectMode| to check the original redirect mode.
// |request| is a new request for redirect. So we don't set the redirect
// mode of it in WebURLLoaderImpl::Context::OnReceivedRedirect().
- ASSERT(request.useStreamOnResponse());
+ DCHECK(request.useStreamOnResponse());
// There is no need to read the body of redirect response because there
// is no way to read the body of opaque-redirect filtered response's
// internal response.
@@ -456,7 +457,7 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
}
if (m_client) {
- ASSERT(m_actualRequest.isNull());
+ DCHECK(m_actualRequest.isNull());
notifyFinished(resource);
}
@@ -567,9 +568,10 @@ void DocumentThreadableLoader::redirectBlocked()
void DocumentThreadableLoader::dataSent(Resource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
{
- ASSERT(m_client);
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_async);
+ DCHECK(m_client);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_checker.dataSent();
m_client->didSendData(bytesSent, totalBytesToBeSent);
@@ -577,10 +579,11 @@ void DocumentThreadableLoader::dataSent(Resource* resource, unsigned long long b
void DocumentThreadableLoader::dataDownloaded(Resource* resource, int dataLength)
{
- ASSERT(m_client);
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_actualRequest.isNull());
- ASSERT(m_async);
+ DCHECK(m_client);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_actualRequest.isNull());
+ DCHECK(m_async);
m_checker.dataDownloaded();
m_client->didDownloadData(dataLength);
@@ -588,17 +591,19 @@ void DocumentThreadableLoader::dataDownloaded(Resource* resource, int dataLength
void DocumentThreadableLoader::didReceiveResourceTiming(Resource* resource, const ResourceTimingInfo& info)
{
- ASSERT(m_client);
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_async);
+ DCHECK(m_client);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_client->didReceiveResourceTiming(info);
}
void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle)
{
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_async);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_checker.responseReceived();
@@ -643,7 +648,7 @@ void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier,
LocalFrame* frame = document().frame();
// We are seeing crashes caused by nullptr (crbug.com/578849). But the frame
// must be set here. TODO(horo): Find the root cause of the unset frame.
- ASSERT(frame);
+ DCHECK(frame);
if (!frame)
return;
DocumentLoader* loader = frame->loader().documentLoader();
@@ -654,7 +659,7 @@ void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier,
void DocumentThreadableLoader::handleResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle)
{
- ASSERT(m_client);
+ DCHECK(m_client);
if (!m_actualRequest.isNull()) {
reportResponseReceived(identifier, response);
@@ -670,7 +675,7 @@ void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
// (For SharedWorker the request won't be CORS or CORS-with-preflight,
// therefore fallback-to-network is handled in the browser process
// when the ServiceWorker does not call respondWith().)
- ASSERT(!m_fallbackRequestForServiceWorker.isNull());
+ DCHECK(!m_fallbackRequestForServiceWorker.isNull());
reportResponseReceived(identifier, response);
loadFallbackRequestForServiceWorker();
return;
@@ -689,7 +694,7 @@ void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
// loadFallbackRequestForServiceWorker().
// FIXME: We should use |m_sameOriginRequest| when we will support
// Suborigins (crbug.com/336894) for Service Worker.
- ASSERT(m_fallbackRequestForServiceWorker.isNull() || getSecurityOrigin()->canRequest(m_fallbackRequestForServiceWorker.url()));
+ DCHECK(m_fallbackRequestForServiceWorker.isNull() || getSecurityOrigin()->canRequest(m_fallbackRequestForServiceWorker.url()));
m_fallbackRequestForServiceWorker = ResourceRequest();
if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessControl) {
@@ -718,8 +723,9 @@ void DocumentThreadableLoader::setSerializedCachedMetadata(Resource*, const char
void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data, size_t dataLength)
{
- ASSERT_UNUSED(resource, resource == this->resource());
- ASSERT(m_async);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_checker.dataReceived();
@@ -733,22 +739,22 @@ void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
void DocumentThreadableLoader::handleReceivedData(const char* data, size_t dataLength)
{
- ASSERT(m_client);
+ DCHECK(m_client);
// Preflight data should be invisible to clients.
if (!m_actualRequest.isNull())
return;
- ASSERT(m_fallbackRequestForServiceWorker.isNull());
+ DCHECK(m_fallbackRequestForServiceWorker.isNull());
m_client->didReceiveData(data, dataLength);
}
void DocumentThreadableLoader::notifyFinished(Resource* resource)
{
- ASSERT(m_client);
- ASSERT(resource == this->resource());
- ASSERT(m_async);
+ DCHECK(m_client);
+ DCHECK(resource == this->resource());
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_async);
m_checker.notifyFinished(resource);
@@ -761,14 +767,14 @@ void DocumentThreadableLoader::notifyFinished(Resource* resource)
void DocumentThreadableLoader::handleSuccessfulFinish(unsigned long identifier, double finishTime)
{
- ASSERT(m_fallbackRequestForServiceWorker.isNull());
+ DCHECK(m_fallbackRequestForServiceWorker.isNull());
if (!m_actualRequest.isNull()) {
// FIXME: Timeout should be applied to whole fetch, not for each of
// preflight and actual request.
m_timeoutTimer.stop();
- ASSERT(!m_sameOriginRequest);
- ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
+ DCHECK(!m_sameOriginRequest);
+ DCHECK(m_options.crossOriginRequestPolicy == UseAccessControl);
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
loadActualRequest();
return;
}
@@ -783,7 +789,8 @@ void DocumentThreadableLoader::handleSuccessfulFinish(unsigned long identifier,
void DocumentThreadableLoader::didTimeout(TimerBase* timer)
{
- ASSERT_UNUSED(timer, timer == &m_timeoutTimer);
+ ALLOW_UNUSED_LOCAL(timer);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(timer == &m_timeoutTimer);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
// Using values from net/base/net_error_list.h ERR_TIMED_OUT,
// Same as existing FIXME above - this error should be coming from FrameLoaderClient to be identifiable.
@@ -849,8 +856,8 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Resou
{
// Any credential should have been removed from the cross-site requests.
const KURL& requestURL = request.url();
- ASSERT(m_sameOriginRequest || requestURL.user().isEmpty());
- ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty());
+ DCHECK(m_sameOriginRequest || requestURL.user().isEmpty());
+ DCHECK(m_sameOriginRequest || requestURL.pass().isEmpty());
// Update resourceLoaderOptions with enforced values.
if (m_forceDoNotAllowStoredCredentials)
@@ -866,7 +873,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Resou
FetchRequest newRequest(request, m_options.initiator, resourceLoaderOptions);
if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
- ASSERT(!resource());
+ DCHECK(!resource());
WeakPtr<DocumentThreadableLoader> self(m_weakFactory.createWeakPtr());
@@ -981,7 +988,7 @@ const SecurityOrigin* DocumentThreadableLoader::getSecurityOrigin() const
Document& DocumentThreadableLoader::document() const
{
- ASSERT(m_document);
+ DCHECK(m_document);
return *m_document;
}

Powered by Google App Engine
This is Rietveld 408576698