Commit 396b6723 authored by steveblock@google.com's avatar steveblock@google.com

Update base/android to use new ScopedJava(Global)Reference

See http://src.chromium.org/viewvc/chrome?view=rev&revision=95821

BUG=
TEST=


Review URL: http://codereview.chromium.org/7491099

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96359 0039d316-1c4b-4281-b951-d872f2087c98
parent 22bef733
......@@ -4,7 +4,6 @@
#include "base/android/jni_android.h"
#include "base/android/auto_jobject.h"
#include "base/logging.h"
namespace {
......
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: michaelbai@google.com (Tao Bai)
// Copyright (c) 2011 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_array.h"
#include "base/android/auto_jobject.h"
#include "base/android/jni_android.h"
#include "base/android/scoped_java_reference.h"
#include "base/logging.h"
namespace base {
......@@ -37,7 +38,7 @@ jobjectArray ToJavaArrayOfByteArray(JNIEnv* env,
return NULL;
for (size_t i = 0; i < count; ++i) {
AutoJObject byte_array = AutoJObject::FromLocalRef(env, ToJavaByteArray(env,
ScopedJavaReference<jobject> byte_array(env, ToJavaByteArray(env,
reinterpret_cast<const uint8*>(v[i].data()), v[i].length()));
if (!byte_array.obj()) {
env->DeleteLocalRef(joa);
......
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: michaelbai@google.com (Tao Bai)
// Copyright (c) 2011 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_ARRAY_H_
#define BASE_ANDROID_JNI_ARRAY_H_
......
......@@ -4,9 +4,9 @@
#include "base/android/path_utils.h"
#include "base/android/auto_jobject.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_reference.h"
#include "jni/path_utils_jni.h"
......@@ -15,20 +15,16 @@ namespace android {
std::string GetDataDirectory() {
JNIEnv* env = AttachCurrentThread();
AutoJObject path = AutoJObject::FromLocalRef(
env, Java_PathUtils_getDataDirectory(
ScopedJavaReference<jstring> path(env, Java_PathUtils_getDataDirectory(
env, base::android::GetApplicationContext()));
return base::android::ConvertJavaStringToUTF8(
env, static_cast<jstring>(path.obj()));
return base::android::ConvertJavaStringToUTF8(env, path.obj());
}
std::string GetCacheDirectory() {
JNIEnv* env = AttachCurrentThread();
AutoJObject path = AutoJObject::FromLocalRef(
env, Java_PathUtils_getCacheDirectory(
ScopedJavaReference<jstring> path(env, Java_PathUtils_getCacheDirectory(
env, base::android::GetApplicationContext()));
return base::android::ConvertJavaStringToUTF8(
env, static_cast<jstring>(path.obj()));
return base::android::ConvertJavaStringToUTF8(env, path.obj());
}
bool RegisterPathUtils(JNIEnv* env) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment