Skip to content

Commit

Permalink
Remove null checking in JavaObjectWeakGlobalRef ctr
Browse files Browse the repository at this point in the history
It is legal to create a weak reference to null. Removes the defensive
null checking being done in the constructors.

BUG=649407

Review-Url: https://codereview.chromium.org/2389403002
Cr-Commit-Position: refs/heads/master@{#423143}
  • Loading branch information
JinsukKim authored and Commit bot committed Oct 5, 2016
1 parent c5eaadd commit 48678a7
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions base/android/jni_weak_ref.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef(JavaObjectWeakGlobalRef&& orig)

JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef(JNIEnv* env, jobject obj)
: obj_(env->NewWeakGlobalRef(obj)) {
DCHECK(obj_);
}

JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef(
JNIEnv* env,
const base::android::JavaRef<jobject>& obj)
: obj_(env->NewWeakGlobalRef(obj.obj())) {
DCHECK(obj_);
}

JavaObjectWeakGlobalRef::~JavaObjectWeakGlobalRef() {
Expand Down

0 comments on commit 48678a7

Please sign in to comment.