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

Unified Diff: runtime/vm/thread_interrupter_android.cc

Issue 1293253005: Completely remove InterruptableThreadState and Fix ThreadRegistry leak (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
Index: runtime/vm/thread_interrupter_android.cc
diff --git a/runtime/vm/thread_interrupter_android.cc b/runtime/vm/thread_interrupter_android.cc
index 493155853cd19316500f897a7ea2d598589c9f30..f0b85a420a8d86a3e54e50c92502bcc7ff677763 100644
--- a/runtime/vm/thread_interrupter_android.cc
+++ b/runtime/vm/thread_interrupter_android.cc
@@ -24,33 +24,36 @@ class ThreadInterrupterAndroid : public AllStatic {
if (signal != SIGPROF) {
return;
}
- InterruptableThreadState* state = ThreadInterrupter::CurrentThreadState();
- if ((state == NULL) || (state->callback == NULL)) {
- // No interrupter state or callback.
+ Thread* thread = Thread::Current();
+ if (thread == NULL) {
+ return;
+ }
+ ThreadInterruptCallback callback = thread->thread_interrupt_callback();
+ void* callback_data = thread->thread_interrupt_data();
+ if (callback == NULL) {
return;
}
- ASSERT(OSThread::Compare(state->id, OSThread::GetCurrentThreadId()));
// Extract thread state.
ucontext_t* context = reinterpret_cast<ucontext_t*>(context_);
mcontext_t mcontext = context->uc_mcontext;
InterruptedThreadState its;
- its.tid = state->id;
+ its.tid = thread->id();
its.pc = SignalHandler::GetProgramCounter(mcontext);
its.fp = SignalHandler::GetFramePointer(mcontext);
its.csp = SignalHandler::GetCStackPointer(mcontext);
its.dsp = SignalHandler::GetDartStackPointer(mcontext);
its.lr = SignalHandler::GetLinkRegister(mcontext);
- state->callback(its, state->data);
+ callback(its, callback_data);
}
};
-void ThreadInterrupter::InterruptThread(InterruptableThreadState* state) {
+void ThreadInterrupter::InterruptThread(Thread* thread) {
if (FLAG_trace_thread_interrupter) {
OS::Print("ThreadInterrupter interrupting %p\n",
- reinterpret_cast<void*>(state->id));
+ reinterpret_cast<void*>(thread->id()));
}
- int result = syscall(__NR_tgkill, getpid(), state->id, SIGPROF);
+ int result = syscall(__NR_tgkill, getpid(), thread->id(), SIGPROF);
ASSERT(result == 0);
}

Powered by Google App Engine
This is Rietveld 408576698