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

Side by Side Diff: third_party/WebKit/Source/core/dom/ClassicPendingScript.h

Issue 2828193003: Explicitly track the lifecycle of PendingScript. (Closed)
Patch Set: . Created 3 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ClassicPendingScript_h 5 #ifndef ClassicPendingScript_h
6 #define ClassicPendingScript_h 6 #define ClassicPendingScript_h
7 7
8 #include "bindings/core/v8/ScriptStreamer.h" 8 #include "bindings/core/v8/ScriptStreamer.h"
9 #include "core/dom/ClassicScript.h" 9 #include "core/dom/ClassicScript.h"
10 #include "core/dom/PendingScript.h" 10 #include "core/dom/PendingScript.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 bool ErrorOccurred() const override; 53 bool ErrorOccurred() const override;
54 bool WasCanceled() const override; 54 bool WasCanceled() const override;
55 void StartStreamingIfPossible(Document*, ScriptStreamer::Type) override; 55 void StartStreamingIfPossible(Document*, ScriptStreamer::Type) override;
56 KURL UrlForClassicScript() const override; 56 KURL UrlForClassicScript() const override;
57 void RemoveFromMemoryCache() override; 57 void RemoveFromMemoryCache() override;
58 void DisposeInternal() override; 58 void DisposeInternal() override;
59 59
60 void Prefinalize(); 60 void Prefinalize();
61 61
62 private: 62 private:
63 enum ReadyState {
64 // These states are considered "not ready".
65 kWaitingForResource,
66 kWaitingForStreaming,
67 // These states are considered "ready".
68 kReady,
69 kErrorOccurred,
70 };
71
63 ClassicPendingScript(ScriptElementBase*, 72 ClassicPendingScript(ScriptElementBase*,
64 ScriptResource*, 73 ScriptResource*,
65 const TextPosition&); 74 const TextPosition&);
66 ClassicPendingScript() = delete; 75 ClassicPendingScript() = delete;
67 76
77 // Advances the current state of the script, reporting to the client if
78 // appropriate.
79 void AdvanceReadyState(ReadyState);
80
68 void CheckState() const override; 81 void CheckState() const override;
69 82
70 // ScriptResourceClient 83 // ScriptResourceClient
71 void NotifyFinished(Resource*) override; 84 void NotifyFinished(Resource*) override;
72 String DebugName() const override { return "PendingScript"; } 85 String DebugName() const override { return "PendingScript"; }
73 void NotifyAppendData(ScriptResource*) override; 86 void NotifyAppendData(ScriptResource*) override;
74 87
75 // MemoryCoordinatorClient 88 // MemoryCoordinatorClient
76 void OnPurgeMemory() override; 89 void OnPurgeMemory() override;
77 90
91 ReadyState ready_state_;
78 bool integrity_failure_; 92 bool integrity_failure_;
79
80 Member<ScriptStreamer> streamer_; 93 Member<ScriptStreamer> streamer_;
81 94
82 // This is a temporary flag to confirm that ClassicPendingScript is not 95 // This is a temporary flag to confirm that ClassicPendingScript is not
83 // touched after its refinalizer call and thus https://crbug.com/715309 96 // touched after its refinalizer call and thus https://crbug.com/715309
84 // doesn't break assumptions. 97 // doesn't break assumptions.
85 // TODO(hiroshige): Check the state in more general way. 98 // TODO(hiroshige): Check the state in more general way.
86 bool prefinalizer_called_ = false; 99 bool prefinalizer_called_ = false;
87 }; 100 };
88 101
89 } // namespace blink 102 } // namespace blink
90 103
91 #endif // PendingScript_h 104 #endif // PendingScript_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698