2011-01-29 Sheriff Bot <webkit.review.bot@gmail.com>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jan 2011 08:23:45 +0000 (08:23 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jan 2011 08:23:45 +0000 (08:23 +0000)
        Unreviewed, rolling out r77050.
        http://trac.webkit.org/changeset/77050
        https://bugs.webkit.org/show_bug.cgi?id=53371

        Caused a crash in Chromium's test_shell_tests (Requested by
        rniwa on #webkit).

        * resources/performance-test.js: Removed.
        * tiny-innerHTML.html: Removed.
2011-01-29  Sheriff Bot  <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r77050.
        http://trac.webkit.org/changeset/77050
        https://bugs.webkit.org/show_bug.cgi?id=53371

        Caused a crash in Chromium's test_shell_tests (Requested by
        rniwa on #webkit).

        * html/parser/HTMLTreeBuilder.cpp:
        (WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext):
        (WebCore::HTMLTreeBuilder::FragmentParsingContext::document):
        (WebCore::HTMLTreeBuilder::FragmentParsingContext::finished):
        * html/parser/HTMLTreeBuilder.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77053 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/Parser/ChangeLog
PerformanceTests/Parser/resources/performance-test.js [deleted file]
PerformanceTests/Parser/tiny-innerHTML.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.h

index 4c927de..d3bc5c6 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r77050.
+        http://trac.webkit.org/changeset/77050
+        https://bugs.webkit.org/show_bug.cgi?id=53371
+
+        Caused a crash in Chromium's test_shell_tests (Requested by
+        rniwa on #webkit).
+
+        * resources/performance-test.js: Removed.
+        * tiny-innerHTML.html: Removed.
+
 2011-01-28  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/PerformanceTests/Parser/resources/performance-test.js b/PerformanceTests/Parser/resources/performance-test.js
deleted file mode 100644 (file)
index 448feb1..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// A basic performance testing harness.
-
-function loadFile(path) {
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", path, false);
-    xhr.send(null);
-    return xhr.responseText;
-}
-
-var logDiv;
-
-function setupLogging() {
-    logDiv = document.createElement("pre");
-    document.body.appendChild(logDiv);
-}
-
-function log(text) {
-    logDiv.innerText += text + "\n";
-    window.scrollTo(document.body.height);
-}
-
-// FIXME: We should make it possible to configure runCount.
-var runCount = 20;
-var completedRuns = -1; // Discard the any runs < 0.
-var times = [];
-
-function computeAverage(values) {
-    var sum = 0;
-    for (var i = 0; i < values.length; i++)
-        sum += values[i];
-    return sum / values.length;
-}
-
-function computeStdev(values) {
-    var average = computeAverage(values);
-    var sumOfSquaredDeviations = 0;
-    for (var i = 0; i < values.length; ++i) {
-        var deviation = values[i] - average;
-        sumOfSquaredDeviations += deviation * deviation;
-    }
-    return Math.sqrt(sumOfSquaredDeviations / values.length);
-}
-
-function logStatistics(times) {
-    log("");
-    log("avg " + computeAverage(times));
-    log("stdev " + computeStdev(times));
-}
-
-var testFunction;
-
-function runPerformanceTest(testFunction) {
-    setupLogging()
-
-    log("Running " + runCount + " times");
-    window.testFunction = testFunction;
-    runOneTest();
-}
-
-function runOneTest() {
-    var start = new Date();
-    window.testFunction();
-    var time = new Date() - start;
-    completedRuns++;
-    if (completedRuns <= 0) {
-        log("Ignoring warm-up run (" + time + ")");
-    } else {
-        times.push(time);
-        log(time);
-    }
-    if (completedRuns < runCount) {
-        window.setTimeout(runOneTest, 0);
-    } else {
-        logStatistics(times);
-    }
-}
diff --git a/PerformanceTests/Parser/tiny-innerHTML.html b/PerformanceTests/Parser/tiny-innerHTML.html
deleted file mode 100644 (file)
index b357cf1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<body>
-<pre id="log"></pre>
-<script src="resources/runner.js"></script>
-<script>
-start(20, function() {
-    var testDiv = document.createElement("div");
-    testDiv.style.display = "none";
-    document.body.appendChild(testDiv);
-    for (var x = 0; x < 100000; x++) {
-        testDiv.innerHTML = "This is a tiny HTML document";
-    }
-    document.body.removeChild(testDiv);
-});
-</script>
-</body>
index f4a60de..6da72c3 100644 (file)
@@ -1,3 +1,18 @@
+2011-01-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r77050.
+        http://trac.webkit.org/changeset/77050
+        https://bugs.webkit.org/show_bug.cgi?id=53371
+
+        Caused a crash in Chromium's test_shell_tests (Requested by
+        rniwa on #webkit).
+
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext):
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::document):
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::finished):
+        * html/parser/HTMLTreeBuilder.h:
+
 2011-01-28  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Darin Adler.
index 6b58afa..97cee13 100644 (file)
@@ -395,50 +395,6 @@ void HTMLTreeBuilder::detach()
     m_tree.detach();
 }
 
-// NOTE: HTML5 requires that we use a dummy document when parsing
-// document fragments.  However, creating a new Document element
-// for each fragment is very slow (Document() does too much work, and
-// innerHTML is a common call).  So we use a shared dummy document.
-// This sharing works because there can only ever be one fragment
-// parser at any time.  Fragment parsing is synchronous and done
-// only from the main thread.  It should be impossible for javascript
-// (or anything else) to ever hold a reference to the dummy document.
-// See https://bugs.webkit.org/show_bug.cgi?id=48719
-class DummyDocumentFactory {
-    WTF_MAKE_NONCOPYABLE(DummyDocumentFactory); WTF_MAKE_FAST_ALLOCATED;
-public:
-    // Use an explicit create/release here to ASSERT this sharing is safe.
-    static HTMLDocument* createDummyDocument();
-    static void releaseDocument(HTMLDocument*);
-
-private:
-    static HTMLDocument* s_sharedDummyDocument;
-    static int s_sharedDummyDocumentMutex;
-};
-
-HTMLDocument* DummyDocumentFactory::createDummyDocument()
-{
-    if (!s_sharedDummyDocument) {
-        s_sharedDummyDocument = HTMLDocument::create(0, KURL()).releaseRef();
-        s_sharedDummyDocumentMutex = 0;
-    }
-    ASSERT(!s_sharedDummyDocumentMutex);
-    ASSERT(!s_sharedDummyDocument->hasChildNodes());
-    s_sharedDummyDocumentMutex++;
-    return s_sharedDummyDocument;
-}
-
-void DummyDocumentFactory::releaseDocument(HTMLDocument* dummyDocument)
-{
-    ASSERT(s_sharedDummyDocument == dummyDocument);
-    s_sharedDummyDocumentMutex--;
-    ASSERT(!s_sharedDummyDocumentMutex);
-    dummyDocument->removeAllChildren();
-}
-
-HTMLDocument* DummyDocumentFactory::s_sharedDummyDocument = 0;
-int DummyDocumentFactory::s_sharedDummyDocumentMutex = 0;
-
 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext()
     : m_fragment(0)
     , m_contextElement(0)
@@ -447,33 +403,27 @@ HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext()
 }
 
 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
-    : m_dummyDocumentForFragmentParsing(DummyDocumentFactory::createDummyDocument())
+    : m_dummyDocumentForFragmentParsing(HTMLDocument::create(0, KURL(), fragment->document()->baseURI()))
     , m_fragment(fragment)
     , m_contextElement(contextElement)
     , m_scriptingPermission(scriptingPermission)
 {
     m_dummyDocumentForFragmentParsing->setCompatibilityMode(fragment->document()->compatibilityMode());
-    // Setting the baseURL should work the same as it would have had we passed
-    // it during HTMLDocument() construction, since the new document is empty.
-    m_dummyDocumentForFragmentParsing->setURL(fragment->document()->baseURI());
 }
 
 Document* HTMLTreeBuilder::FragmentParsingContext::document() const
 {
     ASSERT(m_fragment);
-    return m_dummyDocumentForFragmentParsing;
+    return m_dummyDocumentForFragmentParsing.get();
 }
 
 void HTMLTreeBuilder::FragmentParsingContext::finished()
 {
     // Populate the DocumentFragment with the parsed content now that we're done.
-    ContainerNode* root = m_dummyDocumentForFragmentParsing;
+    ContainerNode* root = m_dummyDocumentForFragmentParsing.get();
     if (m_contextElement)
         root = m_dummyDocumentForFragmentParsing->documentElement();
     m_fragment->takeAllChildrenFrom(root);
-    ASSERT(!m_dummyDocumentForFragmentParsing->hasChildNodes());
-    DummyDocumentFactory::releaseDocument(m_dummyDocumentForFragmentParsing);
-    m_dummyDocumentForFragmentParsing = 0;
 }
 
 HTMLTreeBuilder::FragmentParsingContext::~FragmentParsingContext()
index 2af6158..309ac6f 100644 (file)
@@ -220,9 +220,7 @@ private:
         void finished();
 
     private:
-        // Use a shared dummy document to avoid expensive Document creation.
-        // Hold a raw pointer to the document since there is no need to ref it.
-        HTMLDocument* m_dummyDocumentForFragmentParsing;
+        RefPtr<Document> m_dummyDocumentForFragmentParsing;
         DocumentFragment* m_fragment;
         Element* m_contextElement;