Changeset 155416 in webkit
- Timestamp:
- Sep 9, 2013, 10:42:15 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
dom/Document.cpp (modified) (1 diff)
-
dom/ScriptRunner.cpp (modified) (5 diffs)
-
dom/ScriptRunner.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155414 r155416 1 2013-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 1 11 2013-09-09 Andreas Kling <akling@apple.com> 2 12 -
trunk/Source/WebCore/dom/Document.cpp
r155356 r155416 431 431 , m_startTime(monotonicallyIncreasingTimeMS()) 432 432 , m_overMinimumLayoutThreshold(false) 433 , m_scriptRunner( ScriptRunner::create(this))433 , m_scriptRunner(createOwned<ScriptRunner>(*this)) 434 434 , m_xmlVersion(ASCIILiteral("1.0")) 435 435 , m_xmlStandalone(StandaloneUnspecified) -
trunk/Source/WebCore/dom/ScriptRunner.cpp
r147057 r155416 35 35 namespace WebCore { 36 36 37 ScriptRunner::ScriptRunner(Document *document)37 ScriptRunner::ScriptRunner(Document& document) 38 38 : m_document(document) 39 39 , m_timer(this, &ScriptRunner::timerFired) 40 40 { 41 ASSERT(document);42 41 } 43 42 … … 45 44 { 46 45 for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i) 47 m_document ->decrementLoadEventDelayCount();46 m_document.decrementLoadEventDelayCount(); 48 47 for (size_t i = 0; i < m_scriptsToExecuteInOrder.size(); ++i) 49 m_document ->decrementLoadEventDelayCount();48 m_document.decrementLoadEventDelayCount(); 50 49 for (int i = 0; i < m_pendingAsyncScripts.size(); ++i) 51 m_document ->decrementLoadEventDelayCount();50 m_document.decrementLoadEventDelayCount(); 52 51 } 53 52 … … 61 60 ASSERT(element->inDocument()); 62 61 63 m_document ->incrementLoadEventDelayCount();62 m_document.incrementLoadEventDelayCount(); 64 63 65 64 switch (executionType) { … … 104 103 ASSERT_UNUSED(timer, timer == &m_timer); 105 104 106 Ref Ptr<Document> protect(m_document);105 Ref<Document> protect(m_document); 107 106 108 107 Vector<PendingScript> scripts; … … 120 119 RefPtr<Element> element = scripts[i].releaseElementAndClear(); 121 120 toScriptElementIfPossible(element.get())->execute(cachedScript); 122 m_document ->decrementLoadEventDelayCount();121 m_document.decrementLoadEventDelayCount(); 123 122 } 124 123 } -
trunk/Source/WebCore/dom/ScriptRunner.h
r123451 r155416 45 45 WTF_MAKE_NONCOPYABLE(ScriptRunner); WTF_MAKE_FAST_ALLOCATED; 46 46 public: 47 static PassOwnPtr<ScriptRunner> create(Document* document) { return adoptPtr(new ScriptRunner(document)); }47 explicit ScriptRunner(Document&); 48 48 ~ScriptRunner(); 49 49 … … 56 56 57 57 private: 58 explicit ScriptRunner(Document*);59 60 58 void timerFired(Timer<ScriptRunner>*); 61 59 62 Document *m_document;60 Document& m_document; 63 61 Vector<PendingScript> m_scriptsToExecuteInOrder; 64 62 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.