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

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

Issue 133273007: Revert "Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/TextResourceDecoderBuilder.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 13 matching lines...) Expand all
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/loader/DocumentWriter.h" 30 #include "core/loader/DocumentWriter.h"
31 31
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/ScriptableDocumentParser.h" 33 #include "core/dom/ScriptableDocumentParser.h"
34 #include "core/html/parser/TextResourceDecoder.h" 34 #include "core/fetch/TextResourceDecoder.h"
35 #include "core/loader/FrameLoader.h" 35 #include "core/loader/FrameLoader.h"
36 #include "core/loader/FrameLoaderStateMachine.h" 36 #include "core/loader/FrameLoaderStateMachine.h"
37 #include "core/frame/DOMWindow.h" 37 #include "core/frame/DOMWindow.h"
38 #include "core/frame/Frame.h" 38 #include "core/frame/Frame.h"
39 #include "core/frame/FrameView.h" 39 #include "core/frame/FrameView.h"
40 #include "core/frame/Settings.h" 40 #include "core/frame/Settings.h"
41 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
42 #include "platform/weborigin/SecurityOrigin.h" 42 #include "platform/weborigin/SecurityOrigin.h"
43 #include "wtf/PassOwnPtr.h" 43 #include "wtf/PassOwnPtr.h"
44 44
(...skipping 26 matching lines...) Expand all
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();
81 } 82 }
82 } 83 }
83 84
84 void DocumentWriter::addData(const char* bytes, size_t length) 85 void DocumentWriter::addData(const char* bytes, size_t length)
85 { 86 {
86 ASSERT(m_parser); 87 ASSERT(m_parser);
87 if (m_parser->needsDecoder() && 0 < length) { 88 if (m_parser->needsDecoder() && 0 < length) {
88 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume nt); 89 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume nt);
89 m_parser->setDecoder(decoder.release()); 90 m_parser->setDecoder(decoder.release());
90 } 91 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); 129 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
129 } 130 }
130 131
131 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() 132 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
132 { 133 {
133 ASSERT(m_parser && !m_parser->isStopped()); 134 ASSERT(m_parser && !m_parser->isStopped());
134 m_parser->setDocumentWasLoadedAsPartOfNavigation(); 135 m_parser->setDocumentWasLoadedAsPartOfNavigation();
135 } 136 }
136 137
137 } // namespace WebCore 138 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/TextResourceDecoderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698