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

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

Issue 2846363003: Introduce ClassicPendingScript::is_external_ explicitly (Closed)
Patch Set: fix = Gerrit Patch Set 1 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ClassicPendingScript.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1725e05f9ba1ff137b65d357fb4f057b9007d45f..ec677cffcd1c74eaa7a68a8e837f530be64348c9 100644
--- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
@@ -18,6 +18,7 @@ namespace blink {
ClassicPendingScript* ClassicPendingScript::Create(ScriptElementBase* element,
ScriptResource* resource) {
+ CHECK(resource);
return new ClassicPendingScript(element, resource, TextPosition());
}
@@ -32,10 +33,12 @@ ClassicPendingScript::ClassicPendingScript(
ScriptResource* resource,
const TextPosition& starting_position)
: PendingScript(element, starting_position),
+ is_external_(resource),
ready_state_(resource ? kWaitingForResource : kReady),
integrity_failure_(false) {
- CheckState();
+ CHECK(GetElement());
SetResource(resource);
+ CheckState();
MemoryCoordinator::Instance().RegisterClient(this);
}
@@ -45,6 +48,7 @@ NOINLINE void ClassicPendingScript::CheckState() const {
// TODO(hiroshige): Turn these CHECK()s into DCHECK() before going to beta.
CHECK(!prefinalizer_called_);
CHECK(GetElement());
+ CHECK_EQ(is_external_, !!GetResource());
CHECK(GetResource() || !streamer_);
CHECK(!streamer_ || streamer_->GetResource() == GetResource());
}
@@ -166,7 +170,7 @@ ClassicScript* ClassicPendingScript::GetSource(const KURL& document_url,
DCHECK(IsReady());
error_occurred = ErrorOccurred();
- if (!GetResource()) {
+ if (!is_external_) {
return ClassicScript::Create(ScriptSourceCode(
GetElement()->TextFromChildren(), document_url, StartingPosition()));
}
@@ -314,7 +318,7 @@ bool ClassicPendingScript::IsCurrentlyStreaming() const {
}
bool ClassicPendingScript::WasCanceled() const {
- if (!GetResource())
+ if (!is_external_)
return false;
return GetResource()->WasCanceled();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/ClassicPendingScript.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698