summaryrefslogtreecommitdiffstats
path: root/base/android
diff options
context:
space:
mode:
authornewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 20:01:20 +0000
committernewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 20:01:20 +0000
commit6a718abd7d6f78f4c587cac091b62ca323922e79 (patch)
tree7a6ee32b8d93058aace1b9c3a977e49bceed02e2 /base/android
parentdf6a188b33dcf8d850b8b5f7eeb46f940f8cb4ce (diff)
downloadchromium_src-6a718abd7d6f78f4c587cac091b62ca323922e79.zip
chromium_src-6a718abd7d6f78f4c587cac091b62ca323922e79.tar.gz
chromium_src-6a718abd7d6f78f4c587cac091b62ca323922e79.tar.bz2
Rename jni_helper.h to jni_weak_ref.h.
BUG=365021 TBR=darin Review URL: https://codereview.chromium.org/247263009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android')
-rw-r--r--base/android/jni_helper.h40
-rw-r--r--base/android/jni_weak_ref.cc (renamed from base/android/jni_helper.cc)4
-rw-r--r--base/android/jni_weak_ref.h41
3 files changed, 46 insertions, 39 deletions
diff --git a/base/android/jni_helper.h b/base/android/jni_helper.h
index 895bf95..111fa22 100644
--- a/base/android/jni_helper.h
+++ b/base/android/jni_helper.h
@@ -2,40 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_ANDROID_JNI_HELPER_H_
-#define BASE_ANDROID_JNI_HELPER_H_
-
-#include <jni.h>
-
-#include "base/base_export.h"
-#include "base/android/scoped_java_ref.h"
-
-// Manages WeakGlobalRef lifecycle.
-// This class is not thread-safe w.r.t. get() and reset(). Multiple threads may
-// safely use get() concurrently, but if the user calls reset() (or of course,
-// calls the destructor) they'll need to provide their own synchronization.
-class BASE_EXPORT JavaObjectWeakGlobalRef {
- public:
- JavaObjectWeakGlobalRef();
- JavaObjectWeakGlobalRef(const JavaObjectWeakGlobalRef& orig);
- JavaObjectWeakGlobalRef(JNIEnv* env, jobject obj);
- virtual ~JavaObjectWeakGlobalRef();
-
- void operator=(const JavaObjectWeakGlobalRef& rhs);
-
- base::android::ScopedJavaLocalRef<jobject> get(JNIEnv* env) const;
-
- void reset();
-
- private:
- void Assign(const JavaObjectWeakGlobalRef& rhs);
-
- jweak obj_;
-};
-
-// Get the real object stored in the weak reference returned as a
-// ScopedJavaLocalRef.
-BASE_EXPORT base::android::ScopedJavaLocalRef<jobject> GetRealObject(
- JNIEnv* env, jweak obj);
-
-#endif // BASE_ANDROID_JNI_HELPER_H_
+// This file has been renamed. Please use the new name.
+// TODO(newt): Remove this file when all users have been updated.
+#include "base/android/jni_weak_ref.h"
diff --git a/base/android/jni_helper.cc b/base/android/jni_weak_ref.cc
index fcb610e..35a76da 100644
--- a/base/android/jni_helper.cc
+++ b/base/android/jni_weak_ref.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/android/jni_helper.h"
+#include "base/android/jni_weak_ref.h"
#include "base/android/jni_android.h"
#include "base/logging.h"
diff --git a/base/android/jni_weak_ref.h b/base/android/jni_weak_ref.h
new file mode 100644
index 0000000..ef39b8a
--- /dev/null
+++ b/base/android/jni_weak_ref.h
@@ -0,0 +1,41 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ANDROID_JNI_WEAK_REF_H_
+#define BASE_ANDROID_JNI_WEAK_REF_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/base_export.h"
+
+// Manages WeakGlobalRef lifecycle.
+// This class is not thread-safe w.r.t. get() and reset(). Multiple threads may
+// safely use get() concurrently, but if the user calls reset() (or of course,
+// calls the destructor) they'll need to provide their own synchronization.
+class BASE_EXPORT JavaObjectWeakGlobalRef {
+ public:
+ JavaObjectWeakGlobalRef();
+ JavaObjectWeakGlobalRef(const JavaObjectWeakGlobalRef& orig);
+ JavaObjectWeakGlobalRef(JNIEnv* env, jobject obj);
+ virtual ~JavaObjectWeakGlobalRef();
+
+ void operator=(const JavaObjectWeakGlobalRef& rhs);
+
+ base::android::ScopedJavaLocalRef<jobject> get(JNIEnv* env) const;
+
+ void reset();
+
+ private:
+ void Assign(const JavaObjectWeakGlobalRef& rhs);
+
+ jweak obj_;
+};
+
+// Get the real object stored in the weak reference returned as a
+// ScopedJavaLocalRef.
+BASE_EXPORT base::android::ScopedJavaLocalRef<jobject> GetRealObject(
+ JNIEnv* env, jweak obj);
+
+#endif // BASE_ANDROID_JNI_WEAK_REF_H_