Diff
Modified: trunk/Source/WebCore/ChangeLog (88565 => 88566)
--- trunk/Source/WebCore/ChangeLog 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/ChangeLog 2011-06-10 21:16:20 UTC (rev 88566)
@@ -1,3 +1,29 @@
+2011-06-10 Adam Barth <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Remove Document::finishParsing
+ https://bugs.webkit.org/show_bug.cgi?id=62474
+
+ This function appears to exist only to confuse and befuddle us. This
+ patch prepares for DocumentWriter to grab hold of the parser.
+
+ This patch removes one of the print statements from
+ INSTRUMENT_LAYOUT_SCHEDULING, but I'm not sure
+ INSTRUMENT_LAYOUT_SCHEDULING works anymore anyway.
+
+ * dom/Document.cpp:
+ * dom/Document.h:
+ * dom/XMLDocumentParser.cpp:
+ (WebCore::XMLDocumentParser::finish):
+ * html/parser/HTMLDocumentParser.cpp:
+ (WebCore::HTMLDocumentParser::finish):
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::addData):
+ (WebCore::DocumentWriter::endIfNotLoadingMainResource):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::stop):
+
2011-06-10 Mark Pilgrim <[email protected]>
Reviewed by Tony Chang.
Modified: trunk/Source/WebCore/dom/Document.cpp (88565 => 88566)
--- trunk/Source/WebCore/dom/Document.cpp 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-06-10 21:16:20 UTC (rev 88566)
@@ -2280,22 +2280,6 @@
write("\n", ownerDocument);
}
-void Document::finishParsing()
-{
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!ownerElement())
- printf("Received all data at %d\n", elapsedTime());
-#endif
-
- // Let the parser go through as much data as it can. There will be three possible outcomes after
- // finish() is called:
- // (1) All remaining data is parsed, document isn't loaded yet
- // (2) All remaining data is parsed, document is loaded, parser gets deleted
- // (3) Data is still remaining to be parsed.
- if (m_parser)
- m_parser->finish();
-}
-
const KURL& Document::virtualURL() const
{
return m_url;
Modified: trunk/Source/WebCore/dom/Document.h (88565 => 88566)
--- trunk/Source/WebCore/dom/Document.h 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/dom/Document.h 2011-06-10 21:16:20 UTC (rev 88566)
@@ -589,7 +589,6 @@
void write(const SegmentedString& text, Document* ownerDocument = 0);
void write(const String& text, Document* ownerDocument = 0);
void writeln(const String& text, Document* ownerDocument = 0);
- void finishParsing();
bool wellFormed() const { return m_wellFormed; }
Modified: trunk/Source/WebCore/dom/XMLDocumentParser.cpp (88565 => 88566)
--- trunk/Source/WebCore/dom/XMLDocumentParser.cpp 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/dom/XMLDocumentParser.cpp 2011-06-10 21:16:20 UTC (rev 88566)
@@ -238,8 +238,7 @@
{
// FIXME: We should ASSERT(!m_parserStopped) here, since it does not
// makes sense to call any methods on DocumentParser once it's been stopped.
- // However, FrameLoader::stop calls Document::finishParsing unconditionally
- // which in turn calls m_parser->finish().
+ // However, FrameLoader::stop calls DocumentParser::finish unconditionally.
if (m_parserPaused)
m_finishCalled = true;
Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (88565 => 88566)
--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2011-06-10 21:16:20 UTC (rev 88566)
@@ -416,8 +416,7 @@
{
// FIXME: We should ASSERT(!m_parserStopped) here, since it does not
// makes sense to call any methods on DocumentParser once it's been stopped.
- // However, FrameLoader::stop calls Document::finishParsing unconditionally
- // which in turn calls m_parser->finish().
+ // However, FrameLoader::stop calls DocumentParser::finish unconditionally.
// We're not going to get any more data off the network, so we tell the
// input stream we've reached the end of file. finish() can be called more
Modified: trunk/Source/WebCore/loader/DocumentWriter.cpp (88565 => 88566)
--- trunk/Source/WebCore/loader/DocumentWriter.cpp 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/loader/DocumentWriter.cpp 2011-06-10 21:16:20 UTC (rev 88566)
@@ -198,8 +198,7 @@
if (len == -1)
len = strlen(str);
- DocumentParser* parser = m_frame->document()->parser();
- if (parser)
+ if (DocumentParser* parser = m_frame->document()->parser())
parser->appendBytes(this, str, len, flush);
}
@@ -219,9 +218,11 @@
// so we'll add a protective refcount
RefPtr<Frame> protector(m_frame);
- // make sure nothing's left in there
+ // FIXME: Can we remove this call? Finishing the parser should flush anyway.
addData(0, 0, true);
- m_frame->document()->finishParsing();
+
+ if (DocumentParser* parser = m_frame->document()->parser())
+ parser->finish();
}
String DocumentWriter::encoding() const
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (88565 => 88566)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2011-06-10 21:14:14 UTC (rev 88565)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2011-06-10 21:16:20 UTC (rev 88566)
@@ -447,11 +447,12 @@
// http://bugs.webkit.org/show_bug.cgi?id=10854
// The frame's last ref may be removed and it will be deleted by checkCompleted().
RefPtr<Frame> protector(m_frame);
-
- if (m_frame->document()->parser())
- m_frame->document()->parser()->stopParsing();
- m_frame->document()->finishParsing();
+ if (DocumentParser* parser = m_frame->document()->parser()) {
+ parser->stopParsing();
+ parser->finish();
+ }
+
if (m_iconLoader)
m_iconLoader->stopLoading();
}