| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_service.h" | 5 #include "media/midi/midi_service.h" |
| 6 | 6 |
| 7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "media/midi/midi_manager.h" | 10 #include "media/midi/midi_manager.h" |
| 11 #include "media/midi/midi_switches.h" | 11 #include "media/midi/midi_switches.h" |
| 12 | 12 |
| 13 namespace midi { | 13 namespace midi { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 bool IsDynamicInstantiationEnabled() { | 17 bool IsDynamicInstantiationEnabled() { |
| 18 // TODO(toyoshim): Support on all platforms. See https://crbug.com/672793. | 18 // TODO(toyoshim): Support on all platforms. See https://crbug.com/672793. |
| 19 #if defined(OS_LINUX) || defined(OS_WIN) | 19 #if defined(OS_LINUX) || defined(OS_WIN) |
| 20 return true; |
| 21 #else |
| 20 return base::FeatureList::IsEnabled( | 22 return base::FeatureList::IsEnabled( |
| 21 features::kMidiManagerDynamicInstantiation); | 23 features::kMidiManagerDynamicInstantiation); |
| 22 #else | |
| 23 return false; | |
| 24 #endif | 24 #endif |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 MidiService::MidiService(void) | 29 MidiService::MidiService(void) |
| 30 : is_dynamic_instantiation_enabled_(IsDynamicInstantiationEnabled()), | 30 : is_dynamic_instantiation_enabled_(IsDynamicInstantiationEnabled()), |
| 31 active_clients_(0u) { | 31 active_clients_(0u) { |
| 32 base::AutoLock lock(lock_); | 32 base::AutoLock lock(lock_); |
| 33 | 33 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 base::StringPrintf("MidiServiceThread(%zu)", runner_id)); | 101 base::StringPrintf("MidiServiceThread(%zu)", runner_id)); |
| 102 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 103 threads_[runner_id]->init_com_with_mta(true); | 103 threads_[runner_id]->init_com_with_mta(true); |
| 104 #endif | 104 #endif |
| 105 threads_[runner_id]->Start(); | 105 threads_[runner_id]->Start(); |
| 106 } | 106 } |
| 107 return threads_[runner_id]->task_runner(); | 107 return threads_[runner_id]->task_runner(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace midi | 110 } // namespace midi |
| OLD | NEW |