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

Unified Diff: content/browser/renderer_host/java/java_method.cc

Issue 9584014: Remove env() getter from JavaRef<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-applied downstream patch after it was re-worked Created 8 years, 9 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 | « content/browser/renderer_host/java/java_bound_object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/java/java_method.cc
diff --git a/content/browser/renderer_host/java/java_method.cc b/content/browser/renderer_host/java/java_method.cc
index 01235e89375a8001380ed740a8174901bbed2295..6f6878c790a94d07cd7a5d5fad836efd49720ed5 100644
--- a/content/browser/renderer_host/java/java_method.cc
+++ b/content/browser/renderer_host/java/java_method.cc
@@ -95,7 +95,7 @@ JavaMethod::JavaMethod(const base::android::JavaRef<jobject>& method)
: java_method_(method),
have_calculated_num_parameters_(false),
id_(NULL) {
- JNIEnv* env = java_method_.env();
+ JNIEnv* env = AttachCurrentThread();
// On construction, we do nothing except get the name. Everything else is
// done lazily.
ScopedJavaLocalRef<jstring> name(env, static_cast<jstring>(
@@ -139,7 +139,7 @@ void JavaMethod::EnsureNumParametersIsSetUp() const {
// The number of parameters will be used frequently when determining
// whether to call this method. We don't get the ID etc until actually
// required.
- JNIEnv* env = java_method_.env();
+ JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jarray> parameters(env, static_cast<jarray>(
env->CallObjectMethod(java_method_.obj(), GetMethodIDFromClassName(
env,
@@ -155,7 +155,7 @@ void JavaMethod::EnsureTypesAndIDAreSetUp() const {
}
// Get the parameters
- JNIEnv* env = java_method_.env();
+ JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobjectArray> parameters(env, static_cast<jobjectArray>(
env->CallObjectMethod(java_method_.obj(), GetMethodIDFromClassName(
env,
« no previous file with comments | « content/browser/renderer_host/java/java_bound_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698