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

Unified Diff: Source/core/dom/Document.cpp

Issue 20140002: Remove minimumLayoutDelay() and associated machinery (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: another fix Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 8f69070bcd168e8d745d51fc690cd23f6f08c846..509682eb9af9c40cfca479ad942a8cea17b1535f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -184,10 +184,6 @@ static const double cDefaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
static const unsigned cMaxWriteRecursionDepth = 21;
-// This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
-// FIXME: For faster machines this value can really be lowered to 200. 250 is adequate, but a little high
-// for dual G5s. :)
-static const int cLayoutScheduleThreshold = 250;
// DOM Level 2 says (letters added):
//
@@ -407,10 +403,8 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_cssTarget(0)
, m_processingLoadEvent(false)
, m_loadEventFinished(false)
- , m_startTime(currentTime())
- , m_overMinimumLayoutThreshold(false)
, m_scriptRunner(ScriptRunner::create(this))
- , m_xmlVersion("1.0")
+ , m_xmlVersion(ASCIILiteral("1.0"))
, m_xmlStandalone(StandaloneUnspecified)
, m_hasXMLDeclaration(0)
, m_designMode(inherit)
@@ -1174,6 +1168,8 @@ void Document::setContent(const String& content)
// pump the tokenizer syncrhonously and finish the parse.
m_parser->pinToMainThread();
m_parser->append(content.impl());
+ // FIXME: Append may yield for script execution. Unclear if close()
+ // will wait for the parse to complete before returning or not.
close();
}
@@ -2242,25 +2238,12 @@ void Document::implicitClose()
return;
}
- // Make sure both the initial layout and reflow happen after the onload
- // fires. This will improve onload scores, and other browsers do it.
- // If they wanna cheat, we can too. -dwh
-
- if (frame()->navigationScheduler()->locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
- // Just bail out. Before or during the onload we were shifted to another page.
- // The old i-Bench suite does this. When this happens don't bother painting or laying out.
- m_processingLoadEvent = false;
- view()->unscheduleRelayout();
- return;
- }
-
frame()->loader()->checkCallImplicitClose();
RenderObject* renderObject = renderer();
// We used to force a synchronous display and flush here. This really isn't
// necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
// (if your platform is syncing flushes and limiting them to 60fps).
- m_overMinimumLayoutThreshold = true;
if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->renderer()->needsLayout())) {
updateStyleIfNeeded();
@@ -2315,26 +2298,9 @@ bool Document::shouldScheduleLayout()
|| (documentElement() && !isHTMLHtmlElement(documentElement()));
}
-bool Document::isLayoutTimerActive()
-{
- return view() && view()->layoutPending() && !minimumLayoutDelay();
-}
-
-int Document::minimumLayoutDelay()
-{
- if (m_overMinimumLayoutThreshold)
- return 0;
-
- int elapsed = elapsedTime();
- m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold;
-
- // We'll want to schedule the timer to fire at the minimum layout threshold.
- return max(0, cLayoutScheduleThreshold - elapsed);
-}
-
-int Document::elapsedTime() const
+bool Document::parserShouldYieldAgressivelyBeforeFirstLayout()
{
- return static_cast<int>((currentTime() - m_startTime) * 1000);
+ return view() && view()->layoutPending();
}
void Document::write(const SegmentedString& text, Document* ownerDocument)

Powered by Google App Engine
This is Rietveld 408576698