Add infrastructure for registering built-in native methods.
While I'm here, make fiddling with Thread state easier.
Change-Id: I3d215a3a852aa8970c3974b2edefce9dd261ccd7
diff --git a/src/scoped_jni_thread_state.h b/src/scoped_jni_thread_state.h
index dd39cc3..0da03d6 100644
--- a/src/scoped_jni_thread_state.h
+++ b/src/scoped_jni_thread_state.h
@@ -15,11 +15,11 @@
explicit ScopedJniThreadState(JNIEnv* env)
: env_(reinterpret_cast<JNIEnvExt*>(env)) {
self_ = ThreadForEnv(env);
- self_->SetState(Thread::kRunnable);
+ old_thread_state_ = self_->SetState(Thread::kRunnable);
}
~ScopedJniThreadState() {
- self_->SetState(Thread::kNative);
+ self_->SetState(old_thread_state_);
}
JNIEnvExt* Env() {
@@ -49,6 +49,7 @@
JNIEnvExt* env_;
Thread* self_;
+ Thread::State old_thread_state_;
DISALLOW_COPY_AND_ASSIGN(ScopedJniThreadState);
};