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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp

Issue 1641853003: Create MediaValuesCached and TokenPreloadScanner on the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_MediaValuesCached
Patch Set: Disable test on asan bots Created 4 years, 10 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) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& i nfos) 75 static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& i nfos)
76 { 76 {
77 for (size_t i = 0; i < infos.size(); ++i) 77 for (size_t i = 0; i < infos.size(); ++i)
78 ASSERT(infos[i]->isSafeToSendToAnotherThread()); 78 ASSERT(infos[i]->isSafeToSendToAnotherThread());
79 } 79 }
80 80
81 #endif 81 #endif
82 82
83 void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, PassOwnPtr<WebTaskRunner> loadingT askRunner) 83 void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPt r<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::M ediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTa skRunner)
84 { 84 {
85 new BackgroundHTMLParser(reference, config, loadingTaskRunner); 85 new BackgroundHTMLParser(reference, config, documentURL, cachedDocumentParam eters, mediaValuesCachedData, loadingTaskRunner);
86 // Caller must free by calling stop(). 86 // Caller must free by calling stop().
87 } 87 }
88 88
89 BackgroundHTMLParser::Configuration::Configuration() 89 BackgroundHTMLParser::Configuration::Configuration()
90 : outstandingTokenLimit(defaultOutstandingTokenLimit) 90 : outstandingTokenLimit(defaultOutstandingTokenLimit)
91 , pendingTokenLimit(defaultPendingTokenLimit) 91 , pendingTokenLimit(defaultPendingTokenLimit)
92 { 92 {
93 } 93 }
94 94
95 BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHT MLParser>> reference, PassOwnPtr<Configuration> config, PassOwnPtr<WebTaskRunner > loadingTaskRunner) 95 BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHT MLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValue sCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner)
96 : m_weakFactory(reference, this) 96 : m_weakFactory(reference, this)
97 , m_token(adoptPtr(new HTMLToken)) 97 , m_token(adoptPtr(new HTMLToken))
98 , m_tokenizer(HTMLTokenizer::create(config->options)) 98 , m_tokenizer(HTMLTokenizer::create(config->options))
99 , m_treeBuilderSimulator(config->options) 99 , m_treeBuilderSimulator(config->options)
100 , m_options(config->options) 100 , m_options(config->options)
101 , m_outstandingTokenLimit(config->outstandingTokenLimit) 101 , m_outstandingTokenLimit(config->outstandingTokenLimit)
102 , m_parser(config->parser) 102 , m_parser(config->parser)
103 , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream)) 103 , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream))
104 , m_pendingTokenLimit(config->pendingTokenLimit) 104 , m_pendingTokenLimit(config->pendingTokenLimit)
105 , m_xssAuditor(config->xssAuditor.release()) 105 , m_xssAuditor(config->xssAuditor.release())
106 , m_preloadScanner(config->preloadScanner.release()) 106 , m_preloadScanner(adoptPtr(new TokenPreloadScanner(documentURL, cachedDocum entParameters, mediaValuesCachedData)))
107 , m_decoder(config->decoder.release()) 107 , m_decoder(config->decoder.release())
108 , m_loadingTaskRunner(loadingTaskRunner) 108 , m_loadingTaskRunner(loadingTaskRunner)
109 , m_parsedChunkQueue(config->parsedChunkQueue.release()) 109 , m_parsedChunkQueue(config->parsedChunkQueue.release())
110 , m_startingScript(false) 110 , m_startingScript(false)
111 { 111 {
112 ASSERT(m_outstandingTokenLimit > 0); 112 ASSERT(m_outstandingTokenLimit > 0);
113 ASSERT(m_pendingTokenLimit > 0); 113 ASSERT(m_pendingTokenLimit > 0);
114 ASSERT(m_outstandingTokenLimit >= m_pendingTokenLimit); 114 ASSERT(m_outstandingTokenLimit >= m_pendingTokenLimit);
115 } 115 }
116 116
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (isEmpty) { 296 if (isEmpty) {
297 m_loadingTaskRunner->postTask( 297 m_loadingTaskRunner->postTask(
298 BLINK_FROM_HERE, 298 BLINK_FROM_HERE,
299 new Task(threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChun ks, AllowCrossThreadAccess(m_parser)))); 299 new Task(threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChun ks, AllowCrossThreadAccess(m_parser))));
300 } 300 }
301 301
302 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 302 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
303 } 303 }
304 304
305 } // namespace blink 305 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698