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

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

Issue 1909353003: Allow passing WeakPtr across threads without AllowCrossThreadAccess() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4a_ACTA_ThreadSafeRefCounted
Patch Set: Rebase, Add CrossThreadCopier for WeakPTr Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp » ('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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_loadingTaskRunner->postTask( 160 m_loadingTaskRunner->postTask(
161 BLINK_FROM_HERE, 161 BLINK_FROM_HERE,
162 threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgr oundParser, AllowCrossThreadAccess(m_parser), encodingData)); 162 threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgr oundParser, 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); 299 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint();
300 chunk->tokens = std::move(m_pendingTokens); 300 chunk->tokens = std::move(m_pendingTokens);
301 chunk->startingScript = m_startingScript; 301 chunk->startingScript = m_startingScript;
302 chunk->likelyDocumentWriteScriptIndices.swap(m_likelyDocumentWriteScriptIndi ces); 302 chunk->likelyDocumentWriteScriptIndices.swap(m_likelyDocumentWriteScriptIndi ces);
303 m_startingScript = false; 303 m_startingScript = false;
304 304
305 bool isEmpty = m_parsedChunkQueue->enqueue(std::move(chunk)); 305 bool isEmpty = m_parsedChunkQueue->enqueue(std::move(chunk));
306 if (isEmpty) { 306 if (isEmpty) {
307 m_loadingTaskRunner->postTask( 307 m_loadingTaskRunner->postTask(
308 BLINK_FROM_HERE, 308 BLINK_FROM_HERE,
309 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow CrossThreadAccess(m_parser))); 309 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, m_par ser));
310 } 310 }
311 311
312 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 312 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
313 } 313 }
314 314
315 } // namespace blink 315 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698