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

Side by Side Diff: components/gcm_driver/instance_id/scoped_use_fake_instance_id_android.cc

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android: Don't require RegisterNatives if there are none Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/gcm_driver/instance_id/scoped_use_fake_instance_id_android. h" 5 #include "components/gcm_driver/instance_id/scoped_use_fake_instance_id_android. h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "jni/FakeInstanceIDWithSubtype_jni.h" 8 #include "jni/FakeInstanceIDWithSubtype_jni.h"
9 9
10 using base::android::AttachCurrentThread; 10 using base::android::AttachCurrentThread;
11 11
12 namespace instance_id { 12 namespace instance_id {
13 13
14 // static
15 bool ScopedUseFakeInstanceIDAndroid::RegisterJni(JNIEnv* env) {
16 return RegisterNativesImpl(env);
17 }
18
19 ScopedUseFakeInstanceIDAndroid::ScopedUseFakeInstanceIDAndroid() { 14 ScopedUseFakeInstanceIDAndroid::ScopedUseFakeInstanceIDAndroid() {
20 JNIEnv* env = AttachCurrentThread(); 15 JNIEnv* env = AttachCurrentThread();
21 previous_value_ = 16 previous_value_ =
22 Java_FakeInstanceIDWithSubtype_clearDataAndSetEnabled(env, true); 17 Java_FakeInstanceIDWithSubtype_clearDataAndSetEnabled(env, true);
23 } 18 }
24 19
25 ScopedUseFakeInstanceIDAndroid::~ScopedUseFakeInstanceIDAndroid() { 20 ScopedUseFakeInstanceIDAndroid::~ScopedUseFakeInstanceIDAndroid() {
26 JNIEnv* env = AttachCurrentThread(); 21 JNIEnv* env = AttachCurrentThread();
27 Java_FakeInstanceIDWithSubtype_clearDataAndSetEnabled(env, previous_value_); 22 Java_FakeInstanceIDWithSubtype_clearDataAndSetEnabled(env, previous_value_);
28 } 23 }
29 24
30 } // namespace instance_id 25 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698