| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/midi/midi_output_port_android.h" | 5 #include "media/midi/midi_output_port_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "jni/MidiOutputPortAndroid_jni.h" | 8 #include "jni/MidiOutputPortAndroid_jni.h" |
| 9 | 9 |
| 10 using base::android::ScopedJavaLocalRef; | 10 using base::android::ScopedJavaLocalRef; |
| 11 | 11 |
| 12 namespace media { | |
| 13 namespace midi { | 12 namespace midi { |
| 14 | 13 |
| 15 MidiOutputPortAndroid::MidiOutputPortAndroid(JNIEnv* env, jobject raw) | 14 MidiOutputPortAndroid::MidiOutputPortAndroid(JNIEnv* env, jobject raw) |
| 16 : raw_port_(env, raw) {} | 15 : raw_port_(env, raw) {} |
| 17 MidiOutputPortAndroid::~MidiOutputPortAndroid() { | 16 MidiOutputPortAndroid::~MidiOutputPortAndroid() { |
| 18 Close(); | 17 Close(); |
| 19 } | 18 } |
| 20 | 19 |
| 21 bool MidiOutputPortAndroid::Open() { | 20 bool MidiOutputPortAndroid::Open() { |
| 22 JNIEnv* env = base::android::AttachCurrentThread(); | 21 JNIEnv* env = base::android::AttachCurrentThread(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 } | 33 } |
| 35 | 34 |
| 36 JNIEnv* env = base::android::AttachCurrentThread(); | 35 JNIEnv* env = base::android::AttachCurrentThread(); |
| 37 ScopedJavaLocalRef<jbyteArray> data_to_pass = | 36 ScopedJavaLocalRef<jbyteArray> data_to_pass = |
| 38 base::android::ToJavaByteArray(env, &data[0], data.size()); | 37 base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 39 | 38 |
| 40 Java_MidiOutputPortAndroid_send(env, raw_port_, data_to_pass); | 39 Java_MidiOutputPortAndroid_send(env, raw_port_, data_to_pass); |
| 41 } | 40 } |
| 42 | 41 |
| 43 } // namespace midi | 42 } // namespace midi |
| 44 } // namespace media | |
| OLD | NEW |