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

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

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 years, 3 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/html/HTMLCanvasElement.cpp ('k') | Source/core/html/parser/HTMLParserScheduler.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) 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 void BackgroundHTMLParser::updateDocument(const String& decodedData) 152 void BackgroundHTMLParser::updateDocument(const String& decodedData)
153 { 153 {
154 DocumentEncodingData encodingData(*m_decoder.get()); 154 DocumentEncodingData encodingData(*m_decoder.get());
155 155
156 if (encodingData != m_lastSeenEncodingData) { 156 if (encodingData != m_lastSeenEncodingData) {
157 m_lastSeenEncodingData = encodingData; 157 m_lastSeenEncodingData = encodingData;
158 158
159 m_xssAuditor->setEncoding(encodingData.encoding()); 159 m_xssAuditor->setEncoding(encodingData.encoding());
160 m_scheduler->postLoadingTask( 160 m_scheduler->loadingTaskRunner()->postTask(
161 FROM_HERE, 161 FROM_HERE,
162 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataF romBackgroundParser, AllowCrossThreadAccess(m_parser), encodingData))); 162 threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgr oundParser, AllowCrossThreadAccess(m_parser), encodingData));
163 } 163 }
164 164
165 if (decodedData.isEmpty()) 165 if (decodedData.isEmpty())
166 return; 166 return;
167 167
168 appendDecodedBytes(decodedData); 168 appendDecodedBytes(decodedData);
169 } 169 }
170 170
171 void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint) 171 void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint)
172 { 172 {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 chunk->preloads.swap(m_pendingPreloads); 284 chunk->preloads.swap(m_pendingPreloads);
285 chunk->xssInfos.swap(m_pendingXSSInfos); 285 chunk->xssInfos.swap(m_pendingXSSInfos);
286 chunk->tokenizerState = m_tokenizer->state(); 286 chunk->tokenizerState = m_tokenizer->state();
287 chunk->treeBuilderState = m_treeBuilderSimulator.state(); 287 chunk->treeBuilderState = m_treeBuilderSimulator.state();
288 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size()); 288 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size());
289 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); 289 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint();
290 chunk->tokens = m_pendingTokens.release(); 290 chunk->tokens = m_pendingTokens.release();
291 chunk->startingScript = m_startingScript; 291 chunk->startingScript = m_startingScript;
292 m_startingScript = false; 292 m_startingScript = false;
293 293
294 m_scheduler->postLoadingTask( 294 m_scheduler->loadingTaskRunner()->postTask(
295 FROM_HERE, 295 FROM_HERE,
296 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release()))); 296 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release())));
297 297
298 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 298 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
299 } 299 }
300 300
301 } 301 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/core/html/parser/HTMLParserScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698