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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentWriter.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010. Adam Barth. All rights reserved. 2 * Copyright (C) 2010. Adam Barth. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 m_document->setCompatibilityMode(Document::NoQuirksMode); 77 m_document->setCompatibilityMode(Document::NoQuirksMode);
78 78
79 // FIXME: This should call DocumentParser::appendBytes instead of append 79 // FIXME: This should call DocumentParser::appendBytes instead of append
80 // to support RawDataDocumentParsers. 80 // to support RawDataDocumentParsers.
81 if (DocumentParser* parser = m_document->parser()) 81 if (DocumentParser* parser = m_document->parser())
82 parser->append(source); 82 parser->append(source);
83 } 83 }
84 84
85 void DocumentWriter::addData(const char* bytes, size_t length) 85 void DocumentWriter::addData(const char* bytes, size_t length)
86 { 86 {
87 ASSERT(m_parser); 87 DCHECK(m_parser);
88 if (m_parser->needsDecoder() && 0 < length) { 88 if (m_parser->needsDecoder() && 0 < length) {
89 std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor (m_document); 89 std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor (m_document);
90 m_parser->setDecoder(std::move(decoder)); 90 m_parser->setDecoder(std::move(decoder));
91 } 91 }
92 // appendBytes() can result replacing DocumentLoader::m_writer. 92 // appendBytes() can result replacing DocumentLoader::m_writer.
93 m_parser->appendBytes(bytes, length); 93 m_parser->appendBytes(bytes, length);
94 } 94 }
95 95
96 void DocumentWriter::end() 96 void DocumentWriter::end()
97 { 97 {
98 ASSERT(m_document); 98 DCHECK(m_document);
99 99
100 if (!m_parser) 100 if (!m_parser)
101 return; 101 return;
102 102
103 if (m_parser->needsDecoder()) { 103 if (m_parser->needsDecoder()) {
104 std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor (m_document); 104 std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor (m_document);
105 m_parser->setDecoder(std::move(decoder)); 105 m_parser->setDecoder(std::move(decoder));
106 } 106 }
107 107
108 m_parser->finish(); 108 m_parser->finish();
109 m_parser = nullptr; 109 m_parser = nullptr;
110 m_document = nullptr; 110 m_document = nullptr;
111 } 111 }
112 112
113 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() 113 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
114 { 114 {
115 ASSERT(m_parser && !m_parser->isStopped()); 115 DCHECK(m_parser && !m_parser->isStopped());
tkent 2016/09/13 08:52:09 Split it to two DCHECKs
hiroshige 2016/09/13 09:30:51 Done.
116 m_parser->setDocumentWasLoadedAsPartOfNavigation(); 116 m_parser->setDocumentWasLoadedAsPartOfNavigation();
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698