summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ScriptRunner.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ScriptRunner.h')
-rw-r--r--Source/WebCore/dom/ScriptRunner.h32
1 files changed, 14 insertions, 18 deletions
diff --git a/Source/WebCore/dom/ScriptRunner.h b/Source/WebCore/dom/ScriptRunner.h
index f23e6da0f..8e8f486ad 100644
--- a/Source/WebCore/dom/ScriptRunner.h
+++ b/Source/WebCore/dom/ScriptRunner.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,47 +24,42 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptRunner_h
-#define ScriptRunner_h
+#pragma once
-#include "CachedResourceHandle.h"
+#include "PendingScriptClient.h"
#include "Timer.h"
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/HashSet.h>
#include <wtf/Vector.h>
namespace WebCore {
-class CachedScript;
class Document;
-class PendingScript;
class ScriptElement;
+class LoadableScript;
-class ScriptRunner {
+class ScriptRunner : private PendingScriptClient {
WTF_MAKE_NONCOPYABLE(ScriptRunner); WTF_MAKE_FAST_ALLOCATED;
public:
explicit ScriptRunner(Document&);
~ScriptRunner();
enum ExecutionType { ASYNC_EXECUTION, IN_ORDER_EXECUTION };
- void queueScriptForExecution(ScriptElement*, CachedResourceHandle<CachedScript>, ExecutionType);
+ void queueScriptForExecution(ScriptElement&, LoadableScript&, ExecutionType);
bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty() || !m_scriptsToExecuteInOrder.isEmpty() || !m_pendingAsyncScripts.isEmpty(); }
void suspend();
void resume();
void notifyScriptReady(ScriptElement*, ExecutionType);
private:
- void timerFired(Timer<ScriptRunner>&);
+ void timerFired();
+
+ void notifyFinished(PendingScript&) override;
Document& m_document;
- Vector<PendingScript> m_scriptsToExecuteInOrder;
- Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
- HashMap<ScriptElement*, PendingScript> m_pendingAsyncScripts;
- Timer<ScriptRunner> m_timer;
+ Vector<Ref<PendingScript>> m_scriptsToExecuteInOrder;
+ Vector<RefPtr<PendingScript>> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
+ HashSet<Ref<PendingScript>> m_pendingAsyncScripts;
+ Timer m_timer;
};
}
-
-#endif