| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager_android.h" | 5 #include "media/midi/midi_manager_android.h" |
| 6 | 6 |
| 7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
| 8 #include "base/android/context_utils.h" | 8 #include "base/android/context_utils.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void MidiManagerAndroid::OnInitialized( | 89 void MidiManagerAndroid::OnInitialized( |
| 90 JNIEnv* env, | 90 JNIEnv* env, |
| 91 const JavaParamRef<jobject>& caller, | 91 const JavaParamRef<jobject>& caller, |
| 92 const JavaParamRef<jobjectArray>& devices) { | 92 const JavaParamRef<jobjectArray>& devices) { |
| 93 jsize length = env->GetArrayLength(devices); | 93 jsize length = env->GetArrayLength(devices); |
| 94 | 94 |
| 95 for (jsize i = 0; i < length; ++i) { | 95 for (jsize i = 0; i < length; ++i) { |
| 96 jobject raw_device = env->GetObjectArrayElement(devices, i); | 96 jobject raw_device = env->GetObjectArrayElement(devices, i); |
| 97 AddDevice(base::WrapUnique(new MidiDeviceAndroid(env, raw_device, this))); | 97 AddDevice(base::MakeUnique<MidiDeviceAndroid>(env, raw_device, this)); |
| 98 } | 98 } |
| 99 CompleteInitialization(Result::OK); | 99 CompleteInitialization(Result::OK); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void MidiManagerAndroid::OnAttached(JNIEnv* env, | 102 void MidiManagerAndroid::OnAttached(JNIEnv* env, |
| 103 const JavaParamRef<jobject>& caller, | 103 const JavaParamRef<jobject>& caller, |
| 104 const JavaParamRef<jobject>& raw_device) { | 104 const JavaParamRef<jobject>& raw_device) { |
| 105 AddDevice(base::WrapUnique(new MidiDeviceAndroid(env, raw_device, this))); | 105 AddDevice(base::MakeUnique<MidiDeviceAndroid>(env, raw_device, this)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void MidiManagerAndroid::OnDetached(JNIEnv* env, | 108 void MidiManagerAndroid::OnDetached(JNIEnv* env, |
| 109 const JavaParamRef<jobject>& caller, | 109 const JavaParamRef<jobject>& caller, |
| 110 const JavaParamRef<jobject>& raw_device) { | 110 const JavaParamRef<jobject>& raw_device) { |
| 111 for (auto* device : devices_) { | 111 for (auto* device : devices_) { |
| 112 if (device->HasRawDevice(env, raw_device)) { | 112 if (device->HasRawDevice(env, raw_device)) { |
| 113 for (auto* port : device->input_ports()) { | 113 for (auto* port : device->input_ports()) { |
| 114 DCHECK(input_port_to_index_.end() != input_port_to_index_.find(port)); | 114 DCHECK(input_port_to_index_.end() != input_port_to_index_.find(port)); |
| 115 size_t index = input_port_to_index_[port]; | 115 size_t index = input_port_to_index_[port]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 devices_.push_back(device.release()); | 162 devices_.push_back(device.release()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool MidiManagerAndroid::Register(JNIEnv* env) { | 165 bool MidiManagerAndroid::Register(JNIEnv* env) { |
| 166 return RegisterNativesImpl(env); | 166 return RegisterNativesImpl(env); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace midi | 169 } // namespace midi |
| 170 } // namespace media | 170 } // namespace media |
| OLD | NEW |