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

Unified Diff: Source/web/WebKit.cpp

Issue 1257723002: Simplify ownership of a ThreadState's interruptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch addInterruptor() to take a PassOwnPtr<> Created 5 years, 5 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/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebKit.cpp
diff --git a/Source/web/WebKit.cpp b/Source/web/WebKit.cpp
index a07d210d4651762f8f2377cf55b05d4019bb0734..5e9638c9433ed6b48d9ca8ca44b156bcd88f6969 100644
--- a/Source/web/WebKit.cpp
+++ b/Source/web/WebKit.cpp
@@ -101,8 +101,6 @@ private:
static WebThread::TaskObserver* s_endOfTaskRunner = 0;
static WebThread::TaskObserver* s_pendingGCRunner = 0;
-static ThreadState::Interruptor* s_messageLoopInterruptor = 0;
-static ThreadState::Interruptor* s_isolateInterruptor = 0;
// Make sure we are not re-initialized in the same address space.
// Doing so may cause hard to reproduce crashes.
@@ -114,8 +112,8 @@ void initialize(Platform* platform)
V8Initializer::initializeMainThreadIfNeeded();
- s_isolateInterruptor = new V8IsolateInterruptor(V8PerIsolateData::mainThreadIsolate());
- ThreadState::current()->addInterruptor(s_isolateInterruptor);
+ OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor(V8PerIsolateData::mainThreadIsolate()));
+ ThreadState::current()->addInterruptor(interruptor.release());
ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThreadIsolate(), V8GCController::traceDOMWrappers);
// currentThread is null if we are running on a thread without a message loop.
@@ -186,9 +184,8 @@ void initializeWithoutV8(Platform* platform)
s_pendingGCRunner = new PendingGCRunner;
currentThread->addTaskObserver(s_pendingGCRunner);
- ASSERT(!s_messageLoopInterruptor);
- s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread);
- ThreadState::current()->addInterruptor(s_messageLoopInterruptor);
+ OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterruptor(currentThread));
+ ThreadState::current()->addInterruptor(interruptor.release());
}
DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ());
@@ -208,19 +205,11 @@ void shutdown()
s_endOfTaskRunner = 0;
}
- ASSERT(s_isolateInterruptor);
- ThreadState::current()->removeInterruptor(s_isolateInterruptor);
-
// currentThread() is null if we are running on a thread without a message loop.
if (Platform::current()->currentThread()) {
ASSERT(s_pendingGCRunner);
delete s_pendingGCRunner;
s_pendingGCRunner = 0;
-
- ASSERT(s_messageLoopInterruptor);
- ThreadState::current()->removeInterruptor(s_messageLoopInterruptor);
- delete s_messageLoopInterruptor;
- s_messageLoopInterruptor = 0;
}
// Shutdown V8-related background threads before V8 is ramped down. Note
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698