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

Unified Diff: Source/web/SuspendableScriptExecutor.cpp

Issue 1258653003: Switch SuspendableScriptExecutor over to using SelfKeepAlive<>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: retire m_disposed checking Created 5 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 | « Source/web/SuspendableScriptExecutor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/SuspendableScriptExecutor.cpp
diff --git a/Source/web/SuspendableScriptExecutor.cpp b/Source/web/SuspendableScriptExecutor.cpp
index aff6d72149ea7d5b9d3cdddc53f3e3c255fa695b..5a1b5ebe6dc8e4776791e07ca595afc7886b58e5 100644
--- a/Source/web/SuspendableScriptExecutor.cpp
+++ b/Source/web/SuspendableScriptExecutor.cpp
@@ -17,8 +17,7 @@ namespace blink {
void SuspendableScriptExecutor::createAndRun(LocalFrame* frame, int worldID, const WillBeHeapVector<ScriptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecutionCallback* callback)
{
- RefPtrWillBeRawPtr<SuspendableScriptExecutor> executor = adoptRefWillBeNoop(new SuspendableScriptExecutor(frame, worldID, sources, extensionGroup, userGesture, callback));
- executor->ref();
+ SuspendableScriptExecutor* executor = new SuspendableScriptExecutor(frame, worldID, sources, extensionGroup, userGesture, callback);
executor->run();
}
@@ -32,22 +31,17 @@ void SuspendableScriptExecutor::contextDestroyed()
SuspendableScriptExecutor::SuspendableScriptExecutor(LocalFrame* frame, int worldID, const WillBeHeapVector<ScriptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecutionCallback* callback)
: SuspendableTimer(frame->document())
, m_frame(frame)
- , m_worldID(worldID)
, m_sources(sources)
+ , m_callback(callback)
+ , m_keepAlive(this)
+ , m_worldID(worldID)
, m_extensionGroup(extensionGroup)
, m_userGesture(userGesture)
- , m_callback(callback)
-#if ENABLE(ASSERT)
- , m_disposed(false)
-#endif
{
}
SuspendableScriptExecutor::~SuspendableScriptExecutor()
{
-#if ENABLE(ASSERT)
- ASSERT(m_disposed);
-#endif
}
void SuspendableScriptExecutor::fired()
@@ -70,9 +64,6 @@ void SuspendableScriptExecutor::run()
void SuspendableScriptExecutor::executeAndDestroySelf()
{
- // Ensure that this object is not deleted even if the context is destroyed.
- RefPtrWillBeRawPtr<SuspendableScriptExecutor> protect(this);
-
// after calling the destructor of object - object will be unsubscribed from
// resumed and contextDestroyed LifecycleObserver methods
OwnPtr<UserGestureIndicator> indicator;
@@ -99,23 +90,16 @@ void SuspendableScriptExecutor::executeAndDestroySelf()
void SuspendableScriptExecutor::dispose()
{
-#if ENABLE(ASSERT)
- m_disposed = true;
-#endif
-
-#if ENABLE(OILPAN)
// Remove object as a ContextLifecycleObserver.
ActiveDOMObject::clearContext();
-#endif
- deref();
+ m_keepAlive.clear();
+ stop();
}
DEFINE_TRACE(SuspendableScriptExecutor)
{
-#if ENABLE(OILPAN)
visitor->trace(m_frame);
visitor->trace(m_sources);
-#endif
SuspendableTimer::trace(visitor);
}
« no previous file with comments | « Source/web/SuspendableScriptExecutor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698