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

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

Issue 2640163004: Replace ENABLE(ASSERT) with DCHECK_IS_ON(). (Closed)
Patch Set: Created 3 years, 11 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // been tuned. 57 // been tuned.
58 static const size_t defaultOutstandingTokenLimit = 10000; 58 static const size_t defaultOutstandingTokenLimit = 10000;
59 59
60 // We limit our chucks to 1000 tokens, to make sure the main thread is never 60 // We limit our chucks to 1000 tokens, to make sure the main thread is never
61 // waiting on the parser thread for tokens. This was tuned in 61 // waiting on the parser thread for tokens. This was tuned in
62 // https://bugs.webkit.org/show_bug.cgi?id=110408. 62 // https://bugs.webkit.org/show_bug.cgi?id=110408.
63 static const size_t defaultPendingTokenLimit = 1000; 63 static const size_t defaultPendingTokenLimit = 1000;
64 64
65 using namespace HTMLNames; 65 using namespace HTMLNames;
66 66
67 #if ENABLE(ASSERT) 67 #if DCHECK_IS_ON()
68 68
69 static void checkThatTokensAreSafeToSendToAnotherThread( 69 static void checkThatTokensAreSafeToSendToAnotherThread(
70 const CompactHTMLTokenStream* tokens) { 70 const CompactHTMLTokenStream* tokens) {
71 for (size_t i = 0; i < tokens->size(); ++i) 71 for (size_t i = 0; i < tokens->size(); ++i)
72 ASSERT(tokens->at(i).isSafeToSendToAnotherThread()); 72 ASSERT(tokens->at(i).isSafeToSendToAnotherThread());
73 } 73 }
74 74
75 static void checkThatPreloadsAreSafeToSendToAnotherThread( 75 static void checkThatPreloadsAreSafeToSendToAnotherThread(
76 const PreloadRequestStream& preloads) { 76 const PreloadRequestStream& preloads) {
77 for (size_t i = 0; i < preloads.size(); ++i) 77 for (size_t i = 0; i < preloads.size(); ++i)
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 if (shouldNotifyMainThread) { 312 if (shouldNotifyMainThread) {
313 runOnMainThread(&HTMLDocumentParser::notifyPendingTokenizedChunks, 313 runOnMainThread(&HTMLDocumentParser::notifyPendingTokenizedChunks,
314 m_parser); 314 m_parser);
315 } 315 }
316 } 316 }
317 317
318 bool BackgroundHTMLParser::queueChunkForMainThread() { 318 bool BackgroundHTMLParser::queueChunkForMainThread() {
319 if (m_pendingTokens->isEmpty()) 319 if (m_pendingTokens->isEmpty())
320 return false; 320 return false;
321 321
322 #if ENABLE(ASSERT) 322 #if DCHECK_IS_ON()
323 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get()); 323 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get());
324 checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads); 324 checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads);
325 checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos); 325 checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
326 #endif 326 #endif
327 327
328 double chunkStartTime = monotonicallyIncreasingTimeMS(); 328 double chunkStartTime = monotonicallyIncreasingTimeMS();
329 std::unique_ptr<HTMLDocumentParser::TokenizedChunk> chunk = 329 std::unique_ptr<HTMLDocumentParser::TokenizedChunk> chunk =
330 WTF::wrapUnique(new HTMLDocumentParser::TokenizedChunk); 330 WTF::wrapUnique(new HTMLDocumentParser::TokenizedChunk);
331 TRACE_EVENT_WITH_FLOW0("blink,loading", 331 TRACE_EVENT_WITH_FLOW0("blink,loading",
332 "BackgroundHTMLParser::sendTokensToMainThread", 332 "BackgroundHTMLParser::sendTokensToMainThread",
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if (isMainThread()) { 377 if (isMainThread()) {
378 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); 378 (*WTF::bind(function, std::forward<Ps>(parameters)...))();
379 } else { 379 } else {
380 m_loadingTaskRunner->postTask( 380 m_loadingTaskRunner->postTask(
381 BLINK_FROM_HERE, 381 BLINK_FROM_HERE,
382 crossThreadBind(function, std::forward<Ps>(parameters)...)); 382 crossThreadBind(function, std::forward<Ps>(parameters)...));
383 } 383 }
384 } 384 }
385 385
386 } // namespace blink 386 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698