Index: content/browser/android/jni_helper.h |
diff --git a/content/browser/android/jni_helper.h b/content/browser/android/jni_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3533dc6dda8cbcafe00544d37e3335bd46e28283 |
--- /dev/null |
+++ b/content/browser/android/jni_helper.h |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
John Grabowski
2012/04/19 18:55:27
add content/browser/android/OWNERS file
Ted C
2012/04/19 23:21:07
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_ANDROID_JNI_HELPER_H_ |
+#define CONTENT_BROWSER_ANDROID_JNI_HELPER_H_ |
+ |
+#include <jni.h> |
+ |
+#include "base/android/scoped_java_ref.h" |
+ |
+struct RegistrationMethod { |
+ const char* name; |
+ bool (*func)(JNIEnv* env); |
+}; |
+ |
+// Manages WeakGlobalRef lifecycle. |
+class JavaObjectWeakGlobalRef { |
+ public: |
+ JavaObjectWeakGlobalRef(JNIEnv* env, jobject obj); |
+ virtual ~JavaObjectWeakGlobalRef(); |
+ |
+ base::android::ScopedJavaLocalRef<jobject> get(JNIEnv* env) const; |
+ |
+ private: |
+ jweak obj_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(JavaObjectWeakGlobalRef); |
+}; |
+ |
+// Get the real object stored in the weak reference returned as a |
+// ScopedJavaLocalRef. |
+base::android::ScopedJavaLocalRef<jobject> GetRealObject( |
+ JNIEnv* env, jobject obj); |
+ |
+#endif // CONTENT_BROWSER_ANDROID_JNI_HELPER_H_ |