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

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 276733002: Convert XMLDocumentParser code to Use more reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL
94 { 94 {
95 return &HTMLParserThread::shared()->platformThread(); 95 return &HTMLParserThread::shared()->platformThread();
96 } 96 }
97 97
98 private: 98 private:
99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; 99 WeakPtr<BackgroundHTMLParser> m_backgroundParser;
100 }; 100 };
101 101
102 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors ) 102 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors )
Inactive 2014/05/08 19:45:42 I assume you are planning to update this to take a
maheshkk 2014/05/08 20:02:32 Yep. sure.
103 : ScriptableDocumentParser(document) 103 : ScriptableDocumentParser(*document)
104 , m_options(document) 104 , m_options(document)
105 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) 105 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken))
106 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt ions)) 106 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt ions))
107 , m_scriptRunner(HTMLScriptRunner::create(document, this)) 107 , m_scriptRunner(HTMLScriptRunner::create(document, this))
108 , m_treeBuilder(HTMLTreeBuilder::create(this, document, parserContentPolicy( ), reportErrors, m_options)) 108 , m_treeBuilder(HTMLTreeBuilder::create(this, document, parserContentPolicy( ), reportErrors, m_options))
109 , m_parserScheduler(HTMLParserScheduler::create(this)) 109 , m_parserScheduler(HTMLParserScheduler::create(this))
110 , m_xssAuditorDelegate(document) 110 , m_xssAuditorDelegate(document)
111 , m_weakFactory(this) 111 , m_weakFactory(this)
112 , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) 112 , m_preloader(adoptPtr(new HTMLResourcePreloader(document)))
113 , m_isPinnedToMainThread(false) 113 , m_isPinnedToMainThread(false)
114 , m_endWasDelayed(false) 114 , m_endWasDelayed(false)
115 , m_haveBackgroundParser(false) 115 , m_haveBackgroundParser(false)
116 , m_pumpSessionNestingLevel(0) 116 , m_pumpSessionNestingLevel(0)
117 { 117 {
118 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); 118 ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
119 } 119 }
120 120
121 // FIXME: Member variables should be grouped into self-initializing structs to 121 // FIXME: Member variables should be grouped into self-initializing structs to
122 // minimize code duplication between these constructors. 122 // minimize code duplication between these constructors.
123 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont extElement, ParserContentPolicy parserContentPolicy) 123 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont extElement, ParserContentPolicy parserContentPolicy)
124 : ScriptableDocumentParser(&fragment->document(), parserContentPolicy) 124 : ScriptableDocumentParser(fragment->document(), parserContentPolicy)
125 , m_options(&fragment->document()) 125 , m_options(&fragment->document())
126 , m_token(adoptPtr(new HTMLToken)) 126 , m_token(adoptPtr(new HTMLToken))
127 , m_tokenizer(HTMLTokenizer::create(m_options)) 127 , m_tokenizer(HTMLTokenizer::create(m_options))
128 , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this ->parserContentPolicy(), m_options)) 128 , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this ->parserContentPolicy(), m_options))
129 , m_xssAuditorDelegate(&fragment->document()) 129 , m_xssAuditorDelegate(&fragment->document())
130 , m_weakFactory(this) 130 , m_weakFactory(this)
131 , m_isPinnedToMainThread(true) 131 , m_isPinnedToMainThread(true)
132 , m_endWasDelayed(false) 132 , m_endWasDelayed(false)
133 , m_haveBackgroundParser(false) 133 , m_haveBackgroundParser(false)
134 , m_pumpSessionNestingLevel(0) 134 , m_pumpSessionNestingLevel(0)
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1048 { 1048 {
1049 ASSERT(decoder); 1049 ASSERT(decoder);
1050 DecodedDataDocumentParser::setDecoder(decoder); 1050 DecodedDataDocumentParser::setDecoder(decoder);
1051 1051
1052 if (m_haveBackgroundParser) 1052 if (m_haveBackgroundParser)
1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1054 } 1054 }
1055 1055
1056 } 1056 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698