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

Unified Diff: third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Compile fix Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
index ec677cffcd1c74eaa7a68a8e837f530be64348c9..531b6792e974ba717a34970f741aeecdcb443d5c 100644
--- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
@@ -142,6 +142,9 @@ void ClassicPendingScript::NotifyFinished(Resource* resource) {
ResourceIntegrityDisposition::kPassed;
}
}
+ DCHECK(!resource_data_);
+ resource_data_ = GetResource()->ResourceData();
+ DCHECK(resource_data_);
// We are now waiting for script streaming to finish.
// If there is no script streamer, this step completes immediately.
@@ -159,6 +162,7 @@ void ClassicPendingScript::NotifyAppendData(ScriptResource* resource) {
DEFINE_TRACE(ClassicPendingScript) {
visitor->Trace(streamer_);
+ visitor->Trace(resource_data_);
ResourceOwner<ScriptResource>::Trace(visitor);
MemoryCoordinatorClient::Trace(visitor);
PendingScript::Trace(visitor);
@@ -175,11 +179,11 @@ ClassicScript* ClassicPendingScript::GetSource(const KURL& document_url,
GetElement()->TextFromChildren(), document_url, StartingPosition()));
}
- DCHECK(GetResource()->IsLoaded());
+ CHECK(ResourceData());
bool streamer_ready = (ready_state_ == kReady) && streamer_ &&
!streamer_->StreamingSuppressed();
return ClassicScript::Create(
- ScriptSourceCode(streamer_ready ? streamer_ : nullptr, GetResource()));
+ ScriptSourceCode(streamer_ready ? streamer_ : nullptr, ResourceData()));
}
void ClassicPendingScript::SetStreamer(ScriptStreamer* streamer) {
@@ -324,6 +328,9 @@ bool ClassicPendingScript::WasCanceled() const {
}
KURL ClassicPendingScript::UrlForClassicScript() const {
+ if (ResourceData())
+ return ResourceData()->Url();
+ CHECK(GetResource());
return GetResource()->Url();
}

Powered by Google App Engine
This is Rietveld 408576698