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

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

Issue 218373002: Remove hack in HTMLParserScheduler for deferring to layout while parsing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« 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) 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 HTMLParserScheduler::~HTMLParserScheduler() 83 HTMLParserScheduler::~HTMLParserScheduler()
84 { 84 {
85 m_continueNextChunkTimer.stop(); 85 m_continueNextChunkTimer.stop();
86 } 86 }
87 87
88 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler> * timer) 88 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler> * timer)
89 { 89 {
90 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); 90 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer);
91 // FIXME: The timer class should handle timer priorities instead of this cod e.
92 // If a layout is scheduled, wait again to let the layout timer run first.
93 // FIXME: We should fix this by reducing the max-parse-time instead of
94 // artificially forcing the parser to yield agressively before first layout.
95 if (m_parser->document()->shouldParserYieldAgressivelyBeforeScriptExecution( )) {
abarth-chromium 2014/03/29 20:20:35 Can we delete shouldParserYieldAgressivelyBeforeSc
96 m_continueNextChunkTimer.startOneShot(0, FROM_HERE);
97 return;
98 }
99 m_parser->resumeParsingAfterYield(); 91 m_parser->resumeParsingAfterYield();
100 } 92 }
101 93
102 void HTMLParserScheduler::checkForYieldBeforeScript(PumpSession& session) 94 void HTMLParserScheduler::checkForYieldBeforeScript(PumpSession& session)
103 { 95 {
104 // If we've never painted before and a layout is pending, yield prior to run ning 96 // If we've never painted before and a layout is pending, yield prior to run ning
105 // scripts to give the page a chance to paint earlier. 97 // scripts to give the page a chance to paint earlier.
106 Document* document = m_parser->document(); 98 Document* document = m_parser->document();
107 bool needsFirstPaint = document->view() && !document->view()->hasEverPainted (); 99 bool needsFirstPaint = document->view() && !document->view()->hasEverPainted ();
108 if (needsFirstPaint && document->shouldParserYieldAgressivelyBeforeScriptExe cution()) 100 if (needsFirstPaint && document->shouldParserYieldAgressivelyBeforeScriptExe cution())
109 session.needsYield = true; 101 session.needsYield = true;
110 session.didSeeScript = true; 102 session.didSeeScript = true;
111 } 103 }
112 104
113 void HTMLParserScheduler::scheduleForResume() 105 void HTMLParserScheduler::scheduleForResume()
114 { 106 {
115 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); 107 m_continueNextChunkTimer.startOneShot(0, FROM_HERE);
116 } 108 }
117 109
118
119 void HTMLParserScheduler::suspend() 110 void HTMLParserScheduler::suspend()
120 { 111 {
121 ASSERT(!m_isSuspendedWithActiveTimer); 112 ASSERT(!m_isSuspendedWithActiveTimer);
122 if (!m_continueNextChunkTimer.isActive()) 113 if (!m_continueNextChunkTimer.isActive())
123 return; 114 return;
124 m_isSuspendedWithActiveTimer = true; 115 m_isSuspendedWithActiveTimer = true;
125 m_continueNextChunkTimer.stop(); 116 m_continueNextChunkTimer.stop();
126 } 117 }
127 118
128 void HTMLParserScheduler::resume() 119 void HTMLParserScheduler::resume()
129 { 120 {
130 ASSERT(!m_continueNextChunkTimer.isActive()); 121 ASSERT(!m_continueNextChunkTimer.isActive());
131 if (!m_isSuspendedWithActiveTimer) 122 if (!m_isSuspendedWithActiveTimer)
132 return; 123 return;
133 m_isSuspendedWithActiveTimer = false; 124 m_isSuspendedWithActiveTimer = false;
134 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); 125 m_continueNextChunkTimer.startOneShot(0, FROM_HERE);
135 } 126 }
136 127
137 } 128 }
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