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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 MidiManagerAndroid::~MidiManagerAndroid() {} | 38 MidiManagerAndroid::~MidiManagerAndroid() {} |
39 | 39 |
40 void MidiManagerAndroid::StartInitialization() { | 40 void MidiManagerAndroid::StartInitialization() { |
41 JNIEnv* env = base::android::AttachCurrentThread(); | 41 JNIEnv* env = base::android::AttachCurrentThread(); |
42 | 42 |
43 uintptr_t pointer = reinterpret_cast<uintptr_t>(this); | 43 uintptr_t pointer = reinterpret_cast<uintptr_t>(this); |
44 raw_manager_.Reset(Java_MidiManagerAndroid_create( | 44 raw_manager_.Reset(Java_MidiManagerAndroid_create( |
45 env, base::android::GetApplicationContext(), pointer)); | 45 env, base::android::GetApplicationContext(), pointer)); |
46 scheduler_.reset(new MidiScheduler(this)); | 46 scheduler_.reset(new MidiScheduler(this)); |
47 Java_MidiManagerAndroid_initialize(env, raw_manager_.obj()); | 47 Java_MidiManagerAndroid_initialize(env, raw_manager_); |
48 } | 48 } |
49 | 49 |
50 void MidiManagerAndroid::DispatchSendMidiData(MidiManagerClient* client, | 50 void MidiManagerAndroid::DispatchSendMidiData(MidiManagerClient* client, |
51 uint32_t port_index, | 51 uint32_t port_index, |
52 const std::vector<uint8_t>& data, | 52 const std::vector<uint8_t>& data, |
53 double timestamp) { | 53 double timestamp) { |
54 if (port_index >= all_output_ports_.size()) { | 54 if (port_index >= all_output_ports_.size()) { |
55 // |port_index| is provided by a renderer so we can't believe that it is | 55 // |port_index| is provided by a renderer so we can't believe that it is |
56 // in the valid range. | 56 // in the valid range. |
57 return; | 57 return; |
(...skipping 103 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 |