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

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

Issue 2536553002: Simplify: remove PendingScript::releaseElementAndClear (Closed)
Patch Set: git cl try Created 4 years, 1 month 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/PendingScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.cpp b/third_party/WebKit/Source/core/dom/PendingScript.cpp
index 8123482b414ab1e8dcbe721e41a147076414b22e..2f4ee12b63c43b52d7361876c4ed76b6fc38f0f4 100644
--- a/third_party/WebKit/Source/core/dom/PendingScript.cpp
+++ b/third_party/WebKit/Source/core/dom/PendingScript.cpp
@@ -52,10 +52,18 @@ PendingScript::PendingScript(Element* element, ScriptResource* resource)
PendingScript::~PendingScript() {}
void PendingScript::dispose() {
- if (!m_client)
- return;
stopWatchingForLoad();
- releaseElementAndClear();
+ DCHECK(!m_client);
+ DCHECK(!m_watchingForLoad);
+
+ setScriptResource(nullptr);
+ m_startingPosition = TextPosition::belowRangePosition();
+ m_integrityFailure = false;
+ m_parserBlockingLoadStartTime = 0;
+ if (m_streamer)
+ m_streamer->cancel();
+ m_streamer = nullptr;
+ m_element = nullptr;
}
void PendingScript::watchForLoad(ScriptResourceClient* client) {
@@ -91,18 +99,6 @@ void PendingScript::setElement(Element* element) {
m_element = element;
}
-Element* PendingScript::releaseElementAndClear() {
- setScriptResource(0);
- m_watchingForLoad = false;
- m_startingPosition = TextPosition::belowRangePosition();
- m_integrityFailure = false;
- m_parserBlockingLoadStartTime = 0;
- if (m_streamer)
- m_streamer->cancel();
- m_streamer.release();
- return m_element.release();
-}
-
void PendingScript::setScriptResource(ScriptResource* resource) {
setResource(resource);
}

Powered by Google App Engine
This is Rietveld 408576698