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

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: Replace many DCHECK(a && b) with DCHECK(a) and DCHECK(b) 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 930a2e37b32d975a148e541b2a8cee7fe0a3e3ab..0f767c7707b65a68cc3db550b3d3aed72a16ccf8 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -125,9 +125,9 @@ FrameLoader* DocumentLoader::frameLoader() const
DocumentLoader::~DocumentLoader()
{
- ASSERT(!m_frame);
- ASSERT(!m_mainResource);
- ASSERT(!m_applicationCacheHost);
+ DCHECK(!m_frame);
+ DCHECK(!m_mainResource);
+ DCHECK(!m_applicationCacheHost);
}
DEFINE_TRACE(DocumentLoader)
@@ -196,7 +196,7 @@ Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
resource = RawResource::fetch(request, fetcher());
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
if (resource)
@@ -231,7 +231,7 @@ void DocumentLoader::didChangePerformanceTiming()
void DocumentLoader::didObserveLoadingBehavior(WebLoadingBehaviorFlag behavior)
{
if (frame() && frame()->isMainFrame()) {
- ASSERT(m_state >= Committed);
+ DCHECK_GE(m_state, Committed);
frameLoader()->client()->didObserveLoadingBehavior(behavior);
}
}
@@ -266,8 +266,8 @@ void DocumentLoader::commitIfReady()
void DocumentLoader::notifyFinished(Resource* resource)
{
- ASSERT_UNUSED(resource, m_mainResource == resource);
- ASSERT(m_mainResource);
+ DCHECK_EQ(m_mainResource, resource);
+ DCHECK(m_mainResource);
if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
finishedLoading(m_mainResource->loadFinishTime());
@@ -317,8 +317,8 @@ void DocumentLoader::finishedLoading(double finishTime)
void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
- ASSERT_UNUSED(resource, resource == m_mainResource);
- ASSERT(!redirectResponse.isNull());
+ DCHECK_EQ(resource, m_mainResource);
+ DCHECK(!redirectResponse.isNull());
m_request = request;
// If the redirecting url is not allowed to display content from the target origin,
@@ -335,7 +335,7 @@ void DocumentLoader::redirectReceived(Resource* resource, ResourceRequest& reque
return;
}
- ASSERT(timing().fetchStart());
+ DCHECK(timing().fetchStart());
appendRedirect(requestURL);
didRedirect(redirectResponse.url(), requestURL);
frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
@@ -397,9 +397,9 @@ 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());
+ DCHECK_EQ(m_mainResource, resource);
+ DCHECK(!handle);
+ DCHECK(frame());
m_applicationCacheHost->didReceiveResponseForMainResource(response);
@@ -433,7 +433,7 @@ void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
}
}
- ASSERT(!m_frame->page()->defersLoading());
+ DCHECK(!m_frame->page()->defersLoading());
m_response = response;
@@ -475,7 +475,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())
@@ -488,7 +488,7 @@ void DocumentLoader::ensureWriter(const AtomicString& mimeType, const KURL& over
void DocumentLoader::commitData(const char* bytes, size_t length)
{
- ASSERT(m_state < MainResourceDone);
+ DCHECK_LT(m_state, MainResourceDone);
ensureWriter(m_response.mimeType());
// This can happen if document.close() is called by an event handler while
@@ -504,11 +504,11 @@ 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);
+ DCHECK_EQ(resource, m_mainResource);
+ DCHECK(!m_response.isNull());
+ DCHECK(!m_frame->page()->defersLoading());
if (m_inDataReceived) {
// If this function is reentered, defer processing of the additional
@@ -568,7 +568,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.
@@ -601,7 +601,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;
@@ -642,14 +642,14 @@ bool DocumentLoader::maybeLoadEmpty()
void DocumentLoader::startLoadingMainResource()
{
timing().markNavigationStart();
- ASSERT(!m_mainResource);
- ASSERT(m_state == NotStarted);
+ DCHECK(!m_mainResource);
+ DCHECK_EQ(m_state, NotStarted);
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.
@@ -675,7 +675,7 @@ void DocumentLoader::startLoadingMainResource()
void DocumentLoader::endWriting(DocumentWriter* writer)
{
- ASSERT_UNUSED(writer, m_writer == writer);
+ DCHECK_EQ(m_writer, writer);
m_writer->end();
m_writer.clear();
}
@@ -684,8 +684,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