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

Unified Diff: base/android/jni_generator/testNatives.golden

Issue 115103002: Android: sync up latest JNI generator changes from downstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds missing files Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: base/android/jni_generator/testNatives.golden
diff --git a/base/android/jni_generator/testNatives.golden b/base/android/jni_generator/testNatives.golden
index 2d42f277c19cc3d91afe537f38ae2952e1b23e2c..e56921c7de635f917ee29839ad354d95877e5a9f 100644
--- a/base/android/jni_generator/testNatives.golden
+++ b/base/android/jni_generator/testNatives.golden
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,18 +12,14 @@
#include <jni.h>
-#include "base/android/jni_android.h"
-#include "base/android/scoped_java_ref.h"
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-using base::android::ScopedJavaLocalRef;
+#include "base/android/jni_generator/jni_generator_helper.h"
// Step 1: forward declarations.
namespace {
const char kTestJniClassPath[] = "org/chromium/TestJni";
// Leaking this jclass as we cannot use LazyInstance from some threads.
jclass g_TestJni_clazz = NULL;
+
} // namespace
static jint Init(JNIEnv* env, jobject obj);
@@ -52,9 +48,9 @@ static jobject GetInnerClass(JNIEnv* env, jclass clazz);
// Step 2: method stubs.
static void Destroy(JNIEnv* env, jobject obj,
jint nativeChromeBrowserProvider) {
- DCHECK(nativeChromeBrowserProvider) << "Destroy";
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
+ DCHECK_NATIVE_PTR(native, "Destroy");
return native->Destroy(env, obj);
}
@@ -64,9 +60,9 @@ static jlong AddBookmark(JNIEnv* env, jobject obj,
jstring title,
jboolean isFolder,
jlong parentId) {
- DCHECK(nativeChromeBrowserProvider) << "AddBookmark";
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
+ DCHECK_NATIVE_PTR(native, "AddBookmark", 0);
return native->AddBookmark(env, obj, url, title, isFolder, parentId);
}
@@ -79,9 +75,9 @@ static jlong AddBookmarkFromAPI(JNIEnv* env, jobject obj,
jbyteArray favicon,
jstring title,
jobject visits) {
- DCHECK(nativeChromeBrowserProvider) << "AddBookmarkFromAPI";
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
+ DCHECK_NATIVE_PTR(native, "AddBookmarkFromAPI", 0);
return native->AddBookmarkFromAPI(env, obj, url, created, isBookmark, date,
favicon, title, visits);
}
@@ -92,9 +88,9 @@ static jobject QueryBitmap(JNIEnv* env, jobject obj,
jstring selection,
jobjectArray selectionArgs,
jstring sortOrder) {
- DCHECK(nativeChromeBrowserProvider) << "QueryBitmap";
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
+ DCHECK_NATIVE_PTR(native, "QueryBitmap", NULL);
return native->QueryBitmap(env, obj, projection, selection, selectionArgs,
sortOrder).Release();
}
@@ -104,19 +100,15 @@ static void GotOrientation(JNIEnv* env, jobject obj,
jdouble alpha,
jdouble beta,
jdouble gamma) {
- DCHECK(nativeDataFetcherImplAndroid) << "GotOrientation";
DataFetcherImplAndroid* native =
reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
+ DCHECK_NATIVE_PTR(native, "GotOrientation");
return native->GotOrientation(env, obj, alpha, beta, gamma);
}
// Step 3: RegisterNatives.
-static bool RegisterNativesImpl(JNIEnv* env) {
-
- g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
- base::android::GetClass(env, kTestJniClassPath).obj()));
- static const JNINativeMethod kMethodsTestJni[] = {
+static const JNINativeMethod kMethodsTestJni[] = {
{ "nativeInit",
"("
")"
@@ -200,13 +192,19 @@ static bool RegisterNativesImpl(JNIEnv* env) {
"D"
")"
"V", reinterpret_cast<void*>(GotOrientation) },
- };
+};
+
+static bool RegisterNativesImpl(JNIEnv* env) {
+ g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
+ base::android::GetClass(env, kTestJniClassPath).obj()));
+
const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
if (env->RegisterNatives(g_TestJni_clazz,
kMethodsTestJni,
kMethodsTestJniSize) < 0) {
- LOG(ERROR) << "RegisterNatives failed in " << __FILE__;
+ jni_generator::HandleRegistrationError(
+ env, g_TestJni_clazz, __FILE__);
return false;
}

Powered by Google App Engine
This is Rietveld 408576698