[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 12:29:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit db14697151492547de65a2f1888ab45c092091d4
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 24 20:49:16 2010 +0000

    2010-08-24  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            HTMLTokenizer::create
            https://bugs.webkit.org/show_bug.cgi?id=44477
    
            * html/HTMLDocumentParser.cpp:
            (WebCore::HTMLDocumentParser::HTMLDocumentParser):
            * html/HTMLPreloadScanner.cpp:
            (WebCore::HTMLPreloadScanner::HTMLPreloadScanner):
            (WebCore::HTMLPreloadScanner::scan):
            (WebCore::HTMLPreloadScanner::processToken):
            * html/HTMLPreloadScanner.h:
            * html/HTMLTokenizer.h:
            (WebCore::HTMLTokenizer::create):
            * html/HTMLViewSourceParser.cpp:
            (WebCore::HTMLViewSourceParser::HTMLViewSourceParser):
            (WebCore::HTMLViewSourceParser::pumpTokenizer):
            (WebCore::HTMLViewSourceParser::updateTokenizerState):
            * html/HTMLViewSourceParser.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d897071..f1b9116 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,27 @@
 2010-08-24  Adam Barth  <abarth at webkit.org>
 
+        Reviewed by Eric Seidel.
+
+        HTMLTokenizer::create
+        https://bugs.webkit.org/show_bug.cgi?id=44477
+
+        * html/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::HTMLDocumentParser):
+        * html/HTMLPreloadScanner.cpp:
+        (WebCore::HTMLPreloadScanner::HTMLPreloadScanner):
+        (WebCore::HTMLPreloadScanner::scan):
+        (WebCore::HTMLPreloadScanner::processToken):
+        * html/HTMLPreloadScanner.h:
+        * html/HTMLTokenizer.h:
+        (WebCore::HTMLTokenizer::create):
+        * html/HTMLViewSourceParser.cpp:
+        (WebCore::HTMLViewSourceParser::HTMLViewSourceParser):
+        (WebCore::HTMLViewSourceParser::pumpTokenizer):
+        (WebCore::HTMLViewSourceParser::updateTokenizerState):
+        * html/HTMLViewSourceParser.h:
+
+2010-08-24  Adam Barth  <abarth at webkit.org>
+
         Reviewed by Darin Adler.
 
         Remove references to LegacyHTMLTreebuilder from HTMLTreeBuilder
diff --git a/WebCore/html/HTMLDocumentParser.cpp b/WebCore/html/HTMLDocumentParser.cpp
index 20750b7..8bdaf5c 100644
--- a/WebCore/html/HTMLDocumentParser.cpp
+++ b/WebCore/html/HTMLDocumentParser.cpp
@@ -95,7 +95,7 @@ HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElement, bo
 
 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors)
     : ScriptableDocumentParser(document)
-    , m_tokenizer(new HTMLTokenizer)
+    , m_tokenizer(HTMLTokenizer::create())
     , m_scriptRunner(HTMLScriptRunner::create(document, this))
     , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors))
     , m_parserScheduler(new HTMLParserScheduler(this))
@@ -108,7 +108,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
 // minimize code duplication between these constructors.
 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
     : ScriptableDocumentParser(fragment->document())
-    , m_tokenizer(new HTMLTokenizer)
+    , m_tokenizer(HTMLTokenizer::create())
     , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission))
     , m_endWasDelayed(false)
     , m_writeNestingLevel(0)
diff --git a/WebCore/html/HTMLPreloadScanner.cpp b/WebCore/html/HTMLPreloadScanner.cpp
index 57ac408..edf9d45 100644
--- a/WebCore/html/HTMLPreloadScanner.cpp
+++ b/WebCore/html/HTMLPreloadScanner.cpp
@@ -120,6 +120,7 @@ private:
 HTMLPreloadScanner::HTMLPreloadScanner(Document* document)
     : m_document(document)
     , m_cssScanner(document)
+    , m_tokenizer(HTMLTokenizer::create())
     , m_bodySeen(false)
     , m_inStyle(false)
 {
@@ -134,7 +135,7 @@ void HTMLPreloadScanner::scan()
 {
     // FIXME: We should save and re-use these tokens in HTMLDocumentParser if
     // the pending script doesn't end up calling document.write.
-    while (m_tokenizer.nextToken(m_source, m_token)) {
+    while (m_tokenizer->nextToken(m_source, m_token)) {
         processToken();
         m_token.clear();
     }
@@ -155,12 +156,12 @@ void HTMLPreloadScanner::processToken()
         return;
 
     PreloadTask task(m_token);
-    m_tokenizer.setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer.state(), task.tagName(), m_document->frame()));
+    m_tokenizer->setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer->state(), task.tagName(), m_document->frame()));
     if (task.tagName() == scriptTag) {
         // The tree builder handles scriptTag separately from the other tokenizer
         // state adjustments, so we need to handle it separately too.
-        ASSERT(m_tokenizer.state() == HTMLTokenizer::DataState);
-        m_tokenizer.setState(HTMLTokenizer::ScriptDataState);
+        ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState);
+        m_tokenizer->setState(HTMLTokenizer::ScriptDataState);
     }
 
     if (task.tagName() == bodyTag)
diff --git a/WebCore/html/HTMLPreloadScanner.h b/WebCore/html/HTMLPreloadScanner.h
index ee49ee0..8330b73 100644
--- a/WebCore/html/HTMLPreloadScanner.h
+++ b/WebCore/html/HTMLPreloadScanner.h
@@ -52,9 +52,9 @@ private:
 
     Document* m_document;
     SegmentedString m_source;
-    HTMLTokenizer m_tokenizer;
-    HTMLToken m_token;
     CSSPreloadScanner m_cssScanner;
+    OwnPtr<HTMLTokenizer> m_tokenizer;
+    HTMLToken m_token;
     bool m_bodySeen;
     bool m_inStyle;
 };
diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h
index 6fb3053..2b93e15 100644
--- a/WebCore/html/HTMLTokenizer.h
+++ b/WebCore/html/HTMLTokenizer.h
@@ -29,6 +29,7 @@
 
 #include "SegmentedString.h"
 #include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicString.h>
 
@@ -115,7 +116,7 @@ public:
         CDATASectionState,
     };
 
-    HTMLTokenizer();
+    static PassOwnPtr<HTMLTokenizer> create() { return adoptPtr(new HTMLTokenizer); }
     ~HTMLTokenizer();
 
     void reset();
@@ -231,6 +232,8 @@ private:
         bool m_skipNextNewLine;
     };
 
+    HTMLTokenizer();
+
     inline bool processEntity(SegmentedString&);
 
     inline void parseError();
diff --git a/WebCore/html/HTMLViewSourceParser.cpp b/WebCore/html/HTMLViewSourceParser.cpp
index 2d69fe6..79aecef 100644
--- a/WebCore/html/HTMLViewSourceParser.cpp
+++ b/WebCore/html/HTMLViewSourceParser.cpp
@@ -34,6 +34,7 @@ namespace WebCore {
 
 HTMLViewSourceParser::HTMLViewSourceParser(HTMLViewSourceDocument* document)
     : DecodedDataDocumentParser(document)
+    , m_tokenizer(HTMLTokenizer::create())
 {
 }
 
@@ -48,7 +49,7 @@ void HTMLViewSourceParser::insert(const SegmentedString&)
 
 void HTMLViewSourceParser::pumpTokenizer()
 {
-    while (m_tokenizer.nextToken(m_input.current(), m_token)) {
+    while (m_tokenizer->nextToken(m_input.current(), m_token)) {
         m_token.end(m_input.current().numberOfCharactersConsumed());
         document()->addSource(sourceForToken(), m_token);
         updateTokenizerState();
@@ -86,12 +87,12 @@ void HTMLViewSourceParser::updateTokenizerState()
         return;
 
     AtomicString tagName(m_token.name().data(), m_token.name().size());
-    m_tokenizer.setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer.state(), tagName, m_document->frame()));
+    m_tokenizer->setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer->state(), tagName, m_document->frame()));
     if (tagName == HTMLNames::scriptTag) {
         // The tree builder handles scriptTag separately from the other tokenizer
         // state adjustments, so we need to handle it separately too.
-        ASSERT(m_tokenizer.state() == HTMLTokenizer::DataState);
-        m_tokenizer.setState(HTMLTokenizer::ScriptDataState);
+        ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState);
+        m_tokenizer->setState(HTMLTokenizer::ScriptDataState);
     }
 }
 
diff --git a/WebCore/html/HTMLViewSourceParser.h b/WebCore/html/HTMLViewSourceParser.h
index af333d8..0fc3d4a 100644
--- a/WebCore/html/HTMLViewSourceParser.h
+++ b/WebCore/html/HTMLViewSourceParser.h
@@ -69,7 +69,7 @@ private:
     HTMLInputStream m_input;
     SegmentedString m_source;
     HTMLToken m_token;
-    HTMLTokenizer m_tokenizer;
+    OwnPtr<HTMLTokenizer> m_tokenizer;
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list