Chromium Code Reviews| 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 0be3dcfaacfa6df6aabdf69964b4fca89ff747e7..c45f845e2bd31c63801a7b4a081cf97898b4ebe8 100644 |
| --- a/third_party/WebKit/Source/core/dom/PendingScript.h |
| +++ b/third_party/WebKit/Source/core/dom/PendingScript.h |
| @@ -90,6 +90,7 @@ class CORE_EXPORT PendingScript final |
| void WatchForLoad(PendingScriptClient*); |
| void StopWatchingForLoad(); |
| + bool WatchingForLoad() const { return client_; } |
| ScriptElementBase* GetElement() const; |
| @@ -101,8 +102,14 @@ class CORE_EXPORT PendingScript final |
| void SetStreamer(ScriptStreamer*); |
| void StreamingFinished(); |
| - bool IsReady() const; |
| - bool ErrorOccurred() const; |
| + bool IsReady() const { |
| + CheckState(); |
| + return ready_state_ >= kReady; |
| + } |
| + bool ErrorOccurred() const { |
| + CheckState(); |
| + return ready_state_ == kErrorOccurred; |
| + } |
| void StartStreamingIfPossible(Document*, ScriptStreamer::Type); |
| void Dispose(); |
| @@ -124,7 +131,20 @@ class CORE_EXPORT PendingScript final |
| // MemoryCoordinatorClient |
| void OnPurgeMemory() override; |
| - bool watching_for_load_; |
| + enum ReadyState { |
| + // These states are considered "not ready". |
| + kWaitingForResource, |
| + kWaitingForStreaming, |
| + // These states are considered "ready". |
| + kReady, |
| + kErrorOccurred, |
| + }; |
| + |
| + // Advances the current state of the script, reporting to the client is |
|
hiroshige
2017/04/24 19:16:53
nit: reporting to the client *if*?
jbroman
2017/05/01 15:08:02
Done.
|
| + // appropriate. |
| + void AdvanceReadyState(ReadyState); |
| + |
| + ReadyState ready_state_; |
| // |m_element| must points to the corresponding ScriptLoader's |
| // ScriptElementBase and thus must be non-null before dispose() is called |