OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 { | 71 { |
72 m_document->setCompatibilityMode(Document::NoQuirksMode); | 72 m_document->setCompatibilityMode(Document::NoQuirksMode); |
73 | 73 |
74 // FIXME: This should call DocumentParser::appendBytes instead of append | 74 // FIXME: This should call DocumentParser::appendBytes instead of append |
75 // to support RawDataDocumentParsers. | 75 // to support RawDataDocumentParsers. |
76 if (DocumentParser* parser = m_document->parser()) { | 76 if (DocumentParser* parser = m_document->parser()) { |
77 parser->pinToMainThread(); | 77 parser->pinToMainThread(); |
78 // Because we're pinned to the main thread we don't need to worry about | 78 // Because we're pinned to the main thread we don't need to worry about |
79 // passing ownership of the source string. | 79 // passing ownership of the source string. |
80 parser->append(source.impl()); | 80 parser->append(source.impl()); |
81 parser->setHasAppendedData(); | |
82 } | 81 } |
83 } | 82 } |
84 | 83 |
85 void DocumentWriter::addData(const char* bytes, size_t length) | 84 void DocumentWriter::addData(const char* bytes, size_t length) |
86 { | 85 { |
87 ASSERT(m_parser); | 86 ASSERT(m_parser); |
88 if (m_parser->needsDecoder() && 0 < length) { | 87 if (m_parser->needsDecoder() && 0 < length) { |
89 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); | 88 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); |
90 m_parser->setDecoder(decoder.release()); | 89 m_parser->setDecoder(decoder.release()); |
91 } | 90 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); | 128 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
130 } | 129 } |
131 | 130 |
132 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() | 131 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
133 { | 132 { |
134 ASSERT(m_parser && !m_parser->isStopped()); | 133 ASSERT(m_parser && !m_parser->isStopped()); |
135 m_parser->setDocumentWasLoadedAsPartOfNavigation(); | 134 m_parser->setDocumentWasLoadedAsPartOfNavigation(); |
136 } | 135 } |
137 | 136 |
138 } // namespace WebCore | 137 } // namespace WebCore |
OLD | NEW |