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

Unified Diff: content/browser/renderer_host/java/java_bound_object.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
Index: content/browser/renderer_host/java/java_bound_object.cc
diff --git a/content/browser/renderer_host/java/java_bound_object.cc b/content/browser/renderer_host/java/java_bound_object.cc
index ce13300bdf4fd0d88a7ba41876e4fdd1aeca9567..a9f7920d1c036e2f2547724de8337f9e50a378ec 100644
--- a/content/browser/renderer_host/java/java_bound_object.cc
+++ b/content/browser/renderer_host/java/java_bound_object.cc
@@ -691,21 +691,18 @@ NPObject* JavaBoundObject::Create(const JavaRef<jobject>& object) {
}
JavaBoundObject::JavaBoundObject(const JavaRef<jobject>& object)
- : java_object_(object.env()->NewGlobalRef(object.obj())) {
+ : java_object_(object) {
// We don't do anything with our Java object when first created. We do it all
// lazily when a method is first invoked.
}
JavaBoundObject::~JavaBoundObject() {
- // Use the current thread's JNI env to release our global ref to the Java
- // object.
- AttachCurrentThread()->DeleteGlobalRef(java_object_);
}
jobject JavaBoundObject::GetJavaObject(NPObject* object) {
DCHECK_EQ(&JavaNPObject::kNPClass, object->_class);
JavaBoundObject* jbo = reinterpret_cast<JavaNPObject*>(object)->bound_object;
- return jbo->java_object_;
+ return jbo->java_object_.obj();
}
bool JavaBoundObject::HasMethod(const std::string& name) const {
@@ -746,8 +743,8 @@ bool JavaBoundObject::Invoke(const std::string& name, const NPVariant* args,
}
// Call
- *result = CallJNIMethod(java_object_, method->return_type(), method->id(),
- &parameters[0]);
+ *result = CallJNIMethod(java_object_.obj(), method->return_type(),
+ method->id(), &parameters[0]);
return true;
}
@@ -758,7 +755,7 @@ void JavaBoundObject::EnsureMethodsAreSetUp() const {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jclass> clazz(env, static_cast<jclass>(
- env->CallObjectMethod(java_object_, GetMethodIDFromClassName(
+ env->CallObjectMethod(java_object_.obj(), GetMethodIDFromClassName(
env,
kJavaLangObject,
kGetClass,
« no previous file with comments | « content/browser/renderer_host/java/java_bound_object.h ('k') | content/browser/renderer_host/java/java_method.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698