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

Side by Side Diff: Source/core/loader/DocumentWriter.cpp

Issue 799803004: Demistify DocumentParser::append (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resurrect fixme Created 6 years 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
« no previous file with comments | « Source/core/inspector/DOMPatchSupport.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 visitor->trace(m_document); 72 visitor->trace(m_document);
73 visitor->trace(m_parser); 73 visitor->trace(m_parser);
74 } 74 }
75 75
76 void DocumentWriter::appendReplacingData(const String& source) 76 void DocumentWriter::appendReplacingData(const String& source)
77 { 77 {
78 m_document->setCompatibilityMode(Document::NoQuirksMode); 78 m_document->setCompatibilityMode(Document::NoQuirksMode);
79 79
80 // FIXME: This should call DocumentParser::appendBytes instead of append 80 // FIXME: This should call DocumentParser::appendBytes instead of append
81 // to support RawDataDocumentParsers. 81 // to support RawDataDocumentParsers.
82 if (DocumentParser* parser = m_document->parser()) { 82 if (DocumentParser* parser = m_document->parser())
83 // Because the parser is pinned to the main thread we don't need to worr y about 83 parser->append(source);
84 // passing ownership of the source string.
85 parser->append(source.impl());
86 }
87 } 84 }
88 85
89 void DocumentWriter::addData(const char* bytes, size_t length) 86 void DocumentWriter::addData(const char* bytes, size_t length)
90 { 87 {
91 ASSERT(m_parser); 88 ASSERT(m_parser);
92 if (m_parser->needsDecoder() && 0 < length) { 89 if (m_parser->needsDecoder() && 0 < length) {
93 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume nt); 90 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume nt);
94 m_parser->setDecoder(decoder.release()); 91 m_parser->setDecoder(decoder.release());
95 } 92 }
96 // appendBytes() can result replacing DocumentLoader::m_writer. 93 // appendBytes() can result replacing DocumentLoader::m_writer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); 126 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
130 } 127 }
131 128
132 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() 129 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
133 { 130 {
134 ASSERT(m_parser && !m_parser->isStopped()); 131 ASSERT(m_parser && !m_parser->isStopped());
135 m_parser->setDocumentWasLoadedAsPartOfNavigation(); 132 m_parser->setDocumentWasLoadedAsPartOfNavigation();
136 } 133 }
137 134
138 } // namespace blink 135 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/DOMPatchSupport.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698