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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.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/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index fca45537727c5b82a6ece7969e39f5108a498d7f..f26b6fca27de530fbdabd5b2578d93c1afc0b7f2 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -131,9 +131,9 @@ ResourceLoader* DocumentLoader::mainResourceLoader() const
DocumentLoader::~DocumentLoader()
{
- ASSERT(!m_frame);
- ASSERT(!m_mainResource);
- ASSERT(!m_applicationCacheHost);
+ DCHECK(!m_frame);
+ DCHECK(!m_mainResource);
+ DCHECK(!m_applicationCacheHost);
}
DEFINE_TRACE(DocumentLoader)
@@ -202,7 +202,7 @@ Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
resource = RawResource::fetch(request, fetcher());
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
if (resource)
@@ -237,7 +237,7 @@ void DocumentLoader::didChangePerformanceTiming()
void DocumentLoader::didObserveLoadingBehavior(WebLoadingBehaviorFlag behavior)
{
if (frame() && frame()->isMainFrame()) {
- ASSERT(m_state >= Committed);
+ DCHECK(m_state >= Committed);
yhirano 2016/09/12 04:33:12 DCHECK_GE
hiroshige 2016/09/13 08:43:19 Done.
frameLoader()->client()->didObserveLoadingBehavior(behavior);
}
}
@@ -272,8 +272,9 @@ void DocumentLoader::commitIfReady()
void DocumentLoader::notifyFinished(Resource* resource)
{
- ASSERT_UNUSED(resource, m_mainResource == resource);
- ASSERT(m_mainResource);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(m_mainResource == resource);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(m_mainResource);
if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
finishedLoading(m_mainResource->loadFinishTime());
@@ -323,8 +324,9 @@ void DocumentLoader::finishedLoading(double finishTime)
void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- ASSERT_UNUSED(resource, resource == m_mainResource);
- ASSERT(!redirectResponse.isNull());
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(resource == m_mainResource);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(!redirectResponse.isNull());
m_request = request;
// If the redirecting url is not allowed to display content from the target origin,
@@ -341,7 +343,7 @@ void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque
return;
}
- ASSERT(timing().fetchStart());
+ DCHECK(timing().fetchStart());
appendRedirect(requestURL);
didRedirect(redirectResponse.url(), requestURL);
frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
@@ -403,9 +405,11 @@ void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo
void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle)
{
- ASSERT_UNUSED(resource, m_mainResource == resource);
- ASSERT_UNUSED(handle, !handle);
- ASSERT(frame());
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(m_mainResource == resource);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
+ ALLOW_UNUSED_LOCAL(handle);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(!handle);
+ DCHECK(frame());
m_applicationCacheHost->didReceiveResponseForMainResource(response);
@@ -439,7 +443,7 @@ void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
}
}
- ASSERT(!m_frame->page()->defersLoading());
+ DCHECK(!m_frame->page()->defersLoading());
m_response = response;
@@ -481,7 +485,7 @@ void DocumentLoader::ensureWriter(const AtomicString& mimeType, const KURL& over
DocumentInit init(owner, url(), m_frame);
init.withNewRegistrationContext();
m_frame->loader().clear();
- ASSERT(m_frame->page());
+ DCHECK(m_frame->page());
ParserSynchronizationPolicy parsingPolicy = AllowAsynchronousParsing;
if ((m_substituteData.isValid() && m_substituteData.forceSynchronousLoad()) || !Document::threadedParsingEnabledForTesting())
@@ -494,7 +498,7 @@ void DocumentLoader::ensureWriter(const AtomicString& mimeType, const KURL& over
void DocumentLoader::commitData(const char* bytes, size_t length)
{
- ASSERT(m_state < MainResourceDone);
+ DCHECK(m_state < MainResourceDone);
yhirano 2016/09/12 04:33:12 DCHECK_LT
hiroshige 2016/09/13 08:43:19 Done.
ensureWriter(m_response.mimeType());
// This can happen if document.close() is called by an event handler while
@@ -510,11 +514,12 @@ void DocumentLoader::commitData(const char* bytes, size_t length)
void DocumentLoader::dataReceived(Resource* resource, const char* data, size_t length)
{
- ASSERT(data);
- ASSERT(length);
- ASSERT_UNUSED(resource, resource == m_mainResource);
- ASSERT(!m_response.isNull());
- ASSERT(!m_frame->page()->defersLoading());
+ DCHECK(data);
+ DCHECK(length);
+ ALLOW_UNUSED_LOCAL(resource);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(resource == m_mainResource);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
+ DCHECK(!m_response.isNull());
+ DCHECK(!m_frame->page()->defersLoading());
if (m_inDataReceived) {
// If this function is reentered, defer processing of the additional
@@ -574,7 +579,7 @@ void DocumentLoader::appendRedirect(const KURL& url)
void DocumentLoader::detachFromFrame()
{
- ASSERT(m_frame);
+ DCHECK(m_frame);
// It never makes sense to have a document loader that is detached from its
// frame have any loads active, so go ahead and kill all the loads.
@@ -607,7 +612,7 @@ bool DocumentLoader::maybeCreateArchive()
if (!isArchiveMIMEType(m_response.mimeType()))
return false;
- ASSERT(m_mainResource);
+ DCHECK(m_mainResource);
ArchiveResource* mainResource = m_fetcher->createArchive(m_mainResource.get());
if (!mainResource)
return false;
@@ -653,14 +658,14 @@ void DocumentLoader::upgradeInsecureRequest()
void DocumentLoader::startLoadingMainResource()
{
timing().markNavigationStart();
- ASSERT(!m_mainResource);
- ASSERT(m_state == NotStarted);
+ DCHECK(!m_mainResource);
+ DCHECK(m_state == NotStarted);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:19 Done.
m_state = Provisional;
if (maybeLoadEmpty())
return;
- ASSERT(timing().navigationStart());
+ DCHECK(timing().navigationStart());
// PlzNavigate:
// The fetch has already started in the browser. Don't mark it again.
@@ -686,7 +691,8 @@ void DocumentLoader::startLoadingMainResource()
void DocumentLoader::endWriting(DocumentWriter* writer)
{
- ASSERT_UNUSED(writer, m_writer == writer);
+ ALLOW_UNUSED_LOCAL(writer);
yhirano 2016/09/12 04:33:12 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:19 Done.
+ DCHECK(m_writer == writer);
yhirano 2016/09/12 04:33:12 DCHECK_EQ
hiroshige 2016/09/13 08:43:20 Done.
m_writer->end();
m_writer.clear();
}
@@ -695,8 +701,8 @@ DocumentWriter* DocumentLoader::createWriterFor(const DocumentInit& init, const
{
LocalFrame* frame = init.frame();
- ASSERT(!frame->document() || !frame->document()->isActive());
- ASSERT(frame->tree().childCount() == 0);
+ DCHECK(!frame->document() || !frame->document()->isActive());
+ DCHECK_EQ(frame->tree().childCount(), 0u);
if (!init.shouldReuseDefaultView())
frame->setDOMWindow(LocalDOMWindow::create(*frame));

Powered by Google App Engine
This is Rietveld 408576698