| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // so we'll add a protective refcount | 108 // so we'll add a protective refcount |
| 109 RefPtr<LocalFrame> protector(m_document->frame()); | 109 RefPtr<LocalFrame> protector(m_document->frame()); |
| 110 | 110 |
| 111 if (!m_parser) | 111 if (!m_parser) |
| 112 return; | 112 return; |
| 113 | 113 |
| 114 if (m_parser->needsDecoder()) { | 114 if (m_parser->needsDecoder()) { |
| 115 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); | 115 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); |
| 116 m_parser->setDecoder(decoder.release()); | 116 m_parser->setDecoder(decoder.release()); |
| 117 } | 117 } |
| 118 // flush() can result replacing DocumentLoader::m_writer. | 118 |
| 119 // finish() can result replacing DocumentLoader::m_writer. |
| 119 RefPtrWillBeRawPtr<DocumentWriter> protectingThis(this); | 120 RefPtrWillBeRawPtr<DocumentWriter> protectingThis(this); |
| 120 m_parser->flush(); | |
| 121 | |
| 122 if (!m_parser) | |
| 123 return; | |
| 124 | |
| 125 m_parser->finish(); | 121 m_parser->finish(); |
| 126 m_parser = nullptr; | 122 m_parser = nullptr; |
| 127 m_document = nullptr; | 123 m_document = nullptr; |
| 128 } | 124 } |
| 129 | 125 |
| 130 void DocumentWriter::setUserChosenEncoding(const String& charset) | 126 void DocumentWriter::setUserChosenEncoding(const String& charset) |
| 131 { | 127 { |
| 132 TextResourceDecoder* decoder = m_parser->decoder(); | 128 TextResourceDecoder* decoder = m_parser->decoder(); |
| 133 if (decoder) | 129 if (decoder) |
| 134 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); | 130 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
| 135 } | 131 } |
| 136 | 132 |
| 137 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() | 133 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
| 138 { | 134 { |
| 139 ASSERT(m_parser && !m_parser->isStopped()); | 135 ASSERT(m_parser && !m_parser->isStopped()); |
| 140 m_parser->setDocumentWasLoadedAsPartOfNavigation(); | 136 m_parser->setDocumentWasLoadedAsPartOfNavigation(); |
| 141 } | 137 } |
| 142 | 138 |
| 143 } // namespace blink | 139 } // namespace blink |
| OLD | NEW |