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

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

Issue 2820753002: Revert of Split PendingScript into PendingScript and ClassicPendingScript (Closed)
Patch Set: Created 3 years, 8 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/ScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
index 77cc040f3400f0f5af8bc9f49e42ae0b41fe73e9..b7ffc14fe49f45a40f6278f6b44bea0e0dc5ddd4 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -26,9 +26,9 @@
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptSourceCode.h"
+#include "bindings/core/v8/V8Binding.h"
#include "core/HTMLNames.h"
#include "core/SVGNames.h"
-#include "core/dom/ClassicPendingScript.h"
#include "core/dom/ClassicScript.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentParserTiming.h"
@@ -48,6 +48,7 @@
#include "platform/WebFrameScheduler.h"
#include "platform/loader/fetch/AccessControlStatus.h"
#include "platform/loader/fetch/FetchParameters.h"
+#include "platform/loader/fetch/MemoryCache.h"
#include "platform/loader/fetch/ResourceFetcher.h"
#include "platform/network/mime/MIMETypeRegistry.h"
#include "platform/weborigin/SecurityOrigin.h"
@@ -592,7 +593,7 @@
PendingScript* ScriptLoader::CreatePendingScript() {
CHECK(resource_);
- return ClassicPendingScript::Create(element_, resource_);
+ return PendingScript::Create(element_, resource_);
}
bool ScriptLoader::ExecuteScript(const Script* script) {
@@ -698,14 +699,13 @@
void ScriptLoader::Execute() {
DCHECK(!will_be_parser_executed_);
DCHECK(async_exec_type_ != ScriptRunner::kNone);
- DCHECK(pending_script_->IsExternal());
+ DCHECK(pending_script_->GetResource());
bool error_occurred = false;
Script* script = pending_script_->GetSource(KURL(), error_occurred);
- const bool wasCanceled = pending_script_->WasCanceled();
DetachPendingScript();
if (error_occurred) {
DispatchErrorEvent();
- } else if (!wasCanceled) {
+ } else if (!resource_->WasCanceled()) {
if (ExecuteScript(script))
DispatchLoadEvent();
else
@@ -717,6 +717,7 @@
void ScriptLoader::PendingScriptFinished(PendingScript* pending_script) {
DCHECK(!will_be_parser_executed_);
DCHECK_EQ(pending_script_, pending_script);
+ DCHECK_EQ(pending_script->GetResource(), resource_);
// We do not need this script in the memory cache. The primary goals of
// sending this fetch request are to let the third party server know
@@ -724,8 +725,7 @@
// cache for subsequent uses.
if (document_write_intervention_ ==
DocumentWriteIntervention::kFetchDocWrittenScriptDeferIdle) {
- DCHECK_EQ(pending_script_->GetScriptType(), ScriptType::kClassic);
- pending_script_->RemoveFromMemoryCache();
+ GetMemoryCache()->Remove(pending_script_->GetResource());
pending_script_->StopWatchingForLoad();
return;
}

Powered by Google App Engine
This is Rietveld 408576698