OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/base/android/android_util.h" |
| 6 |
| 7 #include <stddef.h> |
| 8 #include <vector> |
| 9 |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_array.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 std::string JavaBytesToString(JNIEnv* env, jbyteArray j_byte_array) { |
| 16 std::vector<uint8_t> byte_vector; |
| 17 base::android::JavaByteArrayToByteVector(env, j_byte_array, &byte_vector); |
| 18 return std::string(byte_vector.begin(), byte_vector.end()); |
| 19 } |
| 20 |
| 21 JavaObjectPtr CreateJavaObjectPtr(jobject object) { |
| 22 JavaObjectPtr j_object_ptr(new base::android::ScopedJavaGlobalRef<jobject>()); |
| 23 j_object_ptr->Reset(base::android::AttachCurrentThread(), object); |
| 24 return j_object_ptr; |
| 25 } |
| 26 |
| 27 } // namespace media |
OLD | NEW |