| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/android/jni_helper.h" | 5 #include "base/android/jni_weak_ref.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 using base::android::AttachCurrentThread; | 10 using base::android::AttachCurrentThread; |
| 11 | 11 |
| 12 JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef() | 12 JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef() |
| 13 : obj_(NULL) { | 13 : obj_(NULL) { |
| 14 } | 14 } |
| 15 | 15 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void JavaObjectWeakGlobalRef::Assign(const JavaObjectWeakGlobalRef& other) { | 58 void JavaObjectWeakGlobalRef::Assign(const JavaObjectWeakGlobalRef& other) { |
| 59 if (&other == this) | 59 if (&other == this) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 JNIEnv* env = AttachCurrentThread(); | 62 JNIEnv* env = AttachCurrentThread(); |
| 63 if (obj_) | 63 if (obj_) |
| 64 env->DeleteWeakGlobalRef(obj_); | 64 env->DeleteWeakGlobalRef(obj_); |
| 65 | 65 |
| 66 obj_ = other.obj_ ? env->NewWeakGlobalRef(other.obj_) : NULL; | 66 obj_ = other.obj_ ? env->NewWeakGlobalRef(other.obj_) : NULL; |
| 67 } | 67 } |
| OLD | NEW |