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

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

Issue 2753183002: DevTools: migrate remaining parse html probe to probes. (Closed)
Patch Set: review comment addressed. Created 3 years, 9 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/inspector/InspectorTraceEvents.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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 ASSERT(m_tokenizer); 659 ASSERT(m_tokenizer);
660 ASSERT(m_token); 660 ASSERT(m_token);
661 661
662 PumpSession session(m_pumpSessionNestingLevel); 662 PumpSession session(m_pumpSessionNestingLevel);
663 663
664 // We tell the InspectorInstrumentation about every pump, even if we end up 664 // We tell the InspectorInstrumentation about every pump, even if we end up
665 // pumping nothing. It can filter out empty pumps itself. 665 // pumping nothing. It can filter out empty pumps itself.
666 // FIXME: m_input.current().length() is only accurate if we end up parsing the 666 // FIXME: m_input.current().length() is only accurate if we end up parsing the
667 // whole buffer in this pump. We should pass how much we parsed as part of 667 // whole buffer in this pump. We should pass how much we parsed as part of
668 // didWriteHTML instead of willWriteHTML. 668 // didWriteHTML instead of willWriteHTML.
669 TRACE_EVENT_BEGIN1( 669 probe::ParseHTML probe(document(), this);
670 "devtools.timeline", "ParseHTML", "beginData",
671 InspectorParseHtmlEvent::beginData(
672 document(), m_input.current().currentLine().zeroBasedInt()));
673 670
674 if (!isParsingFragment()) 671 if (!isParsingFragment())
675 m_xssAuditor.init(document(), &m_xssAuditorDelegate); 672 m_xssAuditor.init(document(), &m_xssAuditorDelegate);
676 673
677 while (canTakeNextToken()) { 674 while (canTakeNextToken()) {
678 if (m_xssAuditor.isEnabled()) 675 if (m_xssAuditor.isEnabled())
679 m_sourceTracker.start(m_input.current(), m_tokenizer.get(), token()); 676 m_sourceTracker.start(m_input.current(), m_tokenizer.get(), token());
680 677
681 if (!m_tokenizer->nextToken(m_input.current(), token())) 678 if (!m_tokenizer->nextToken(m_input.current(), token()))
682 break; 679 break;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // parsing case, adding paranoia if for speculative crash fix for 714 // parsing case, adding paranoia if for speculative crash fix for
718 // crbug.com/465478 715 // crbug.com/465478
719 if (m_preloader) { 716 if (m_preloader) {
720 if (!m_preloadScanner) { 717 if (!m_preloadScanner) {
721 m_preloadScanner = createPreloadScanner(); 718 m_preloadScanner = createPreloadScanner();
722 m_preloadScanner->appendToEnd(m_input.current()); 719 m_preloadScanner->appendToEnd(m_input.current());
723 } 720 }
724 scanAndPreload(m_preloadScanner.get()); 721 scanAndPreload(m_preloadScanner.get());
725 } 722 }
726 } 723 }
727
728 TRACE_EVENT_END1("devtools.timeline", "ParseHTML", "endData",
729 InspectorParseHtmlEvent::endData(
730 m_input.current().currentLine().zeroBasedInt() - 1));
731 } 724 }
732 725
733 void HTMLDocumentParser::constructTreeFromHTMLToken() { 726 void HTMLDocumentParser::constructTreeFromHTMLToken() {
734 AtomicHTMLToken atomicToken(token()); 727 AtomicHTMLToken atomicToken(token());
735 728
736 // We clear the m_token in case constructTreeFromAtomicToken 729 // We clear the m_token in case constructTreeFromAtomicToken
737 // synchronously re-enters the parser. We don't clear the token immedately 730 // synchronously re-enters the parser. We don't clear the token immedately
738 // for Character tokens because the AtomicHTMLToken avoids copying the 731 // for Character tokens because the AtomicHTMLToken avoids copying the
739 // characters by keeping a pointer to the underlying buffer in the 732 // characters by keeping a pointer to the underlying buffer in the
740 // HTMLToken. Fortunately, Character tokens can't cause us to re-enter 733 // HTMLToken. Fortunately, Character tokens can't cause us to re-enter
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 successHistogram.count(duration); 1313 successHistogram.count(duration);
1321 } else { 1314 } else {
1322 DEFINE_STATIC_LOCAL( 1315 DEFINE_STATIC_LOCAL(
1323 CustomCountHistogram, failureHistogram, 1316 CustomCountHistogram, failureHistogram,
1324 ("PreloadScanner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); 1317 ("PreloadScanner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50));
1325 failureHistogram.count(duration); 1318 failureHistogram.count(duration);
1326 } 1319 }
1327 } 1320 }
1328 1321
1329 } // namespace blink 1322 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698