Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: media/midi/midi_manager_android.cc

Issue 2673423002: Web MIDI: add dynamic MidiManager instantiation support for Linux (Closed)
Patch Set: rebase again Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/midi/midi_manager_android.h ('k') | media/midi/midi_manager_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 "NOUGAT") { 44 "NOUGAT") {
45 return sdk_version >= base::android::SDK_VERSION_NOUGAT; 45 return sdk_version >= base::android::SDK_VERSION_NOUGAT;
46 } 46 }
47 47
48 // Otherwise, allow to use MidiManagerAndroid on M and later versions. 48 // Otherwise, allow to use MidiManagerAndroid on M and later versions.
49 return sdk_version >= base::android::SDK_VERSION_MARSHMALLOW; 49 return sdk_version >= base::android::SDK_VERSION_MARSHMALLOW;
50 } 50 }
51 51
52 } // namespace 52 } // namespace
53 53
54 MidiManager* MidiManager::Create() { 54 MidiManager* MidiManager::Create(MidiService* service) {
55 if (IsMidiManagerAndroidEnabled()) 55 if (IsMidiManagerAndroidEnabled())
56 return new MidiManagerAndroid(); 56 return new MidiManagerAndroid(service);
57 57
58 return new MidiManagerUsb(base::MakeUnique<UsbMidiDeviceFactoryAndroid>()); 58 return new MidiManagerUsb(service,
59 base::MakeUnique<UsbMidiDeviceFactoryAndroid>());
59 } 60 }
60 61
61 MidiManagerAndroid::MidiManagerAndroid() {} 62 MidiManagerAndroid::MidiManagerAndroid(MidiService* service)
63 : MidiManager(service) {}
62 64
63 MidiManagerAndroid::~MidiManagerAndroid() { 65 MidiManagerAndroid::~MidiManagerAndroid() {
64 base::AutoLock auto_lock(scheduler_lock_); 66 base::AutoLock auto_lock(scheduler_lock_);
65 CHECK(!scheduler_); 67 CHECK(!scheduler_);
66 } 68 }
67 69
68 void MidiManagerAndroid::StartInitialization() { 70 void MidiManagerAndroid::StartInitialization() {
69 JNIEnv* env = base::android::AttachCurrentThread(); 71 JNIEnv* env = base::android::AttachCurrentThread();
70 72
71 uintptr_t pointer = reinterpret_cast<uintptr_t>(this); 73 uintptr_t pointer = reinterpret_cast<uintptr_t>(this);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 device->GetDeviceVersion(), PortState::CONNECTED)); 207 device->GetDeviceVersion(), PortState::CONNECTED));
206 } 208 }
207 devices_.push_back(device.release()); 209 devices_.push_back(device.release());
208 } 210 }
209 211
210 bool MidiManagerAndroid::Register(JNIEnv* env) { 212 bool MidiManagerAndroid::Register(JNIEnv* env) {
211 return RegisterNativesImpl(env); 213 return RegisterNativesImpl(env);
212 } 214 }
213 215
214 } // namespace midi 216 } // namespace midi
OLDNEW
« no previous file with comments | « media/midi/midi_manager_android.h ('k') | media/midi/midi_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698