Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: third_party/WebKit/Source/core/dom/PendingScript.h

Issue 2549143009: Create PendingScriptClient as a separate client interface for PendingScript. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/PendingScript.h
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.h b/third_party/WebKit/Source/core/dom/PendingScript.h
index b29c0fa61c3f2c59f8a0b53b6ca9135ff25fb7b6..fa93534bb18539165a05ec5ed1f81f702fd691a5 100644
--- a/third_party/WebKit/Source/core/dom/PendingScript.h
+++ b/third_party/WebKit/Source/core/dom/PendingScript.h
@@ -38,8 +38,22 @@
namespace blink {
class Element;
+class PendingScript;
class ScriptSourceCode;
+class CORE_EXPORT PendingScriptClient : public GarbageCollectedMixin {
+ public:
+ virtual ~PendingScriptClient() {}
+
+ // Invoked when the pending script has finished loading. This could be during
+ // |watchForLoad| (if the pending script was already ready), or when the
+ // resource loads (if script streaming is not occurring), or when script
+ // streaming finishes.
+ virtual void pendingScriptFinished(PendingScript*) = 0;
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
+};
+
// A container for an external script which may be loaded and executed.
//
// TODO(kochi): The comment below is from pre-oilpan age and may not be correct
@@ -71,7 +85,7 @@ class CORE_EXPORT PendingScript final
return m_parserBlockingLoadStartTime;
}
- void watchForLoad(ScriptResourceClient*);
+ void watchForLoad(PendingScriptClient*);
void stopWatchingForLoad();
Element* element() const { return m_element.get(); }
@@ -79,10 +93,6 @@ class CORE_EXPORT PendingScript final
void setScriptResource(ScriptResource*);
- void notifyFinished(Resource*) override;
- String debugName() const override { return "PendingScript"; }
- void notifyAppendData(ScriptResource*) override;
-
DECLARE_TRACE();
ScriptSourceCode getSource(const KURL& documentURL,
@@ -100,6 +110,12 @@ class CORE_EXPORT PendingScript final
PendingScript(Element*, ScriptResource*);
PendingScript() = delete;
+ // ScriptResourceClient
+ void notifyFinished(Resource*) override;
+ String debugName() const override { return "PendingScript"; }
+ void notifyAppendData(ScriptResource*) override;
+
+ // MemoryCoordinatorClient
void onMemoryStateChange(MemoryState) override;
bool m_watchingForLoad;
@@ -109,7 +125,7 @@ class CORE_EXPORT PendingScript final
double m_parserBlockingLoadStartTime;
Member<ScriptStreamer> m_streamer;
- Member<ScriptResourceClient> m_client;
+ Member<PendingScriptClient> m_client;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698