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

Unified Diff: Source/core/workers/Worker.cpp

Issue 177073004: Oilpan: move core/workers to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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: Source/core/workers/Worker.cpp
diff --git a/Source/core/workers/Worker.cpp b/Source/core/workers/Worker.cpp
index e5c76ceee5e97e9c068fbeca9e1892668cac78d6..d2e3bde5815525ee54d42e5b9b3f97ba5efa31a5 100644
--- a/Source/core/workers/Worker.cpp
+++ b/Source/core/workers/Worker.cpp
@@ -50,7 +50,7 @@ inline Worker::Worker(ExecutionContext* context)
ScriptWrappable::init(this);
}
-PassRefPtr<Worker> Worker::create(ExecutionContext* context, const String& url, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<Worker> Worker::create(ExecutionContext* context, const String& url, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
Document* document = toDocument(context);
@@ -62,7 +62,7 @@ PassRefPtr<Worker> Worker::create(ExecutionContext* context, const String& url,
WorkerGlobalScopeProxyProvider* proxyProvider = WorkerGlobalScopeProxyProvider::from(*document->page());
ASSERT(proxyProvider);
- RefPtr<Worker> worker = adoptRef(new Worker(context));
+ RefPtrWillBeRawPtr<Worker> worker = adoptRefCountedWillBeRefCountedGarbageCollected(new Worker(context));
worker->suspendIfNeeded();
@@ -103,7 +103,12 @@ void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
void Worker::terminate()
{
- m_contextProxy->terminateWorkerGlobalScope();
+ // NOTE: oilpan: if the Worker fails to fully construct (e.g., invalid URL),
sof 2014/02/24 12:53:29 I'll remove this comment before finalizing; just w
+ // it'll be without a 'context proxy' object but in the heap. If the document
+ // is detached prior to the next GC, it stops active DOM objects, which
+ // will run into a null ptr crash here. Hence, the need for the check.
+ if (m_contextProxy)
+ m_contextProxy->terminateWorkerGlobalScope();
haraken 2014/02/24 13:28:36 Don't you need to clear m_contextProxy in terminat
}
void Worker::stop()
@@ -137,4 +142,9 @@ void Worker::notifyFinished()
unsetPendingActivity(this);
}
+void Worker::trace(Visitor* visitor)
+{
+ visitor->trace(m_scriptLoader);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698