⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 155416 in webkit


Ignore:
Timestamp:
Sep 9, 2013, 10:42:15 PM (13 years ago)
Author:
akling@apple.com
Message:

ScriptRunner should have a Document& internally.
<https://webkit.org/b/121072>

Reviewed by Anders Carlsson.

Change ScriptRunner::m_document to a reference since it's tied to
the lifetime of the Document.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155414 r155416  
     12013-09-09  Andreas Kling  <akling@apple.com>
     2
     3        ScriptRunner should have a Document& internally.
     4        <https://webkit.org/b/121072>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Change ScriptRunner::m_document to a reference since it's tied to
     9        the lifetime of the Document.
     10
    1112013-09-09  Andreas Kling  <akling@apple.com>
    212
  • trunk/Source/WebCore/dom/Document.cpp

    r155356 r155416  
    431431    , m_startTime(monotonicallyIncreasingTimeMS())
    432432    , m_overMinimumLayoutThreshold(false)
    433     , m_scriptRunner(ScriptRunner::create(this))
     433    , m_scriptRunner(createOwned<ScriptRunner>(*this))
    434434    , m_xmlVersion(ASCIILiteral("1.0"))
    435435    , m_xmlStandalone(StandaloneUnspecified)
  • trunk/Source/WebCore/dom/ScriptRunner.cpp

    r147057 r155416  
    3535namespace WebCore {
    3636
    37 ScriptRunner::ScriptRunner(Document* document)
     37ScriptRunner::ScriptRunner(Document& document)
    3838    : m_document(document)
    3939    , m_timer(this, &ScriptRunner::timerFired)
    4040{
    41     ASSERT(document);
    4241}
    4342
     
    4544{
    4645    for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i)
    47         m_document->decrementLoadEventDelayCount();
     46        m_document.decrementLoadEventDelayCount();
    4847    for (size_t i = 0; i < m_scriptsToExecuteInOrder.size(); ++i)
    49         m_document->decrementLoadEventDelayCount();
     48        m_document.decrementLoadEventDelayCount();
    5049    for (int i = 0; i < m_pendingAsyncScripts.size(); ++i)
    51         m_document->decrementLoadEventDelayCount();
     50        m_document.decrementLoadEventDelayCount();
    5251}
    5352
     
    6160    ASSERT(element->inDocument());
    6261
    63     m_document->incrementLoadEventDelayCount();
     62    m_document.incrementLoadEventDelayCount();
    6463
    6564    switch (executionType) {
     
    104103    ASSERT_UNUSED(timer, timer == &m_timer);
    105104
    106     RefPtr<Document> protect(m_document);
     105    Ref<Document> protect(m_document);
    107106
    108107    Vector<PendingScript> scripts;
     
    120119        RefPtr<Element> element = scripts[i].releaseElementAndClear();
    121120        toScriptElementIfPossible(element.get())->execute(cachedScript);
    122         m_document->decrementLoadEventDelayCount();
     121        m_document.decrementLoadEventDelayCount();
    123122    }
    124123}
  • trunk/Source/WebCore/dom/ScriptRunner.h

    r123451 r155416  
    4545    WTF_MAKE_NONCOPYABLE(ScriptRunner); WTF_MAKE_FAST_ALLOCATED;
    4646public:
    47     static PassOwnPtr<ScriptRunner> create(Document* document) { return adoptPtr(new ScriptRunner(document)); }
     47    explicit ScriptRunner(Document&);
    4848    ~ScriptRunner();
    4949
     
    5656
    5757private:
    58     explicit ScriptRunner(Document*);
    59 
    6058    void timerFired(Timer<ScriptRunner>*);
    6159
    62     Document* m_document;
     60    Document& m_document;
    6361    Vector<PendingScript> m_scriptsToExecuteInOrder;
    6462    Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
Note: See TracChangeset for help on using the changeset viewer.