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

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

Issue 1318463004: Fix race between updatedocument and sendTokensToMainThread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | no next file » | 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 Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(&H TMLDocumentParser::didReceiveEncodingDataFromBackgroundParser, AllowCrossThreadA ccess(m_parser), encodingData)); 160 m_scheduler->postLoadingTask(
161 FROM_HERE,
162 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataF romBackgroundParser, AllowCrossThreadAccess(m_parser), encodingData)));
161 } 163 }
162 164
163 if (decodedData.isEmpty()) 165 if (decodedData.isEmpty())
164 return; 166 return;
165 167
166 appendDecodedBytes(decodedData); 168 appendDecodedBytes(decodedData);
167 } 169 }
168 170
169 void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint) 171 void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint)
170 { 172 {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 m_startingScript = false; 288 m_startingScript = false;
287 289
288 m_scheduler->postLoadingTask( 290 m_scheduler->postLoadingTask(
289 FROM_HERE, 291 FROM_HERE,
290 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release()))); 292 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release())));
291 293
292 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 294 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
293 } 295 }
294 296
295 } 297 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698