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

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

Issue 2841493003: Web MIDI: remove old Windows backend (Closed)
Patch Set: rebase Created 3 years, 8 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/OWNERS ('k') | media/midi/midi_manager_win.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/dynamically_initialized_midi_manager_win.h" 5 #include "media/midi/dynamically_initialized_midi_manager_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <ks.h> 9 #include <ks.h>
10 #include <ksmedia.h> 10 #include <ksmedia.h>
11 #include <mmreg.h> 11 #include <mmreg.h>
12 #include <mmsystem.h> 12 #include <mmsystem.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <string> 15 #include <string>
16 16
17 #include "base/bind_helpers.h" 17 #include "base/bind_helpers.h"
18 #include "base/callback.h" 18 #include "base/callback.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/strings/string16.h" 21 #include "base/strings/string16.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
25 #include "base/win/windows_version.h"
25 #include "device/usb/usb_ids.h" 26 #include "device/usb/usb_ids.h"
26 #include "media/midi/message_util.h" 27 #include "media/midi/message_util.h"
28 #include "media/midi/midi_manager_winrt.h"
27 #include "media/midi/midi_port_info.h" 29 #include "media/midi/midi_port_info.h"
28 #include "media/midi/midi_service.h" 30 #include "media/midi/midi_service.h"
31 #include "media/midi/midi_switches.h"
29 32
30 namespace midi { 33 namespace midi {
31 34
32 // Forward declaration of PortManager for anonymous functions and internal 35 // Forward declaration of PortManager for anonymous functions and internal
33 // classes to use it. 36 // classes to use it.
34 class DynamicallyInitializedMidiManagerWin::PortManager { 37 class DynamicallyInitializedMidiManagerWin::PortManager {
35 public: 38 public:
36 // Calculates event time from elapsed time that system provides. 39 // Calculates event time from elapsed time that system provides.
37 base::TimeTicks CalculateInEventTime(size_t index, uint32_t elapsed_ms) const; 40 base::TimeTicks CalculateInEventTime(size_t index, uint32_t elapsed_ms) const;
38 41
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 uint32_t port_index, 848 uint32_t port_index,
846 const std::vector<uint8_t>& data) { 849 const std::vector<uint8_t>& data) {
847 CHECK_GT(port_manager_->outputs()->size(), port_index); 850 CHECK_GT(port_manager_->outputs()->size(), port_index);
848 (*port_manager_->outputs())[port_index]->Send(data); 851 (*port_manager_->outputs())[port_index]->Send(data);
849 // |client| will be checked inside MidiManager::AccumulateMidiBytesSent. 852 // |client| will be checked inside MidiManager::AccumulateMidiBytesSent.
850 PostReplyTask( 853 PostReplyTask(
851 base::Bind(&DynamicallyInitializedMidiManagerWin::AccumulateMidiBytesSent, 854 base::Bind(&DynamicallyInitializedMidiManagerWin::AccumulateMidiBytesSent,
852 base::Unretained(this), client, data.size())); 855 base::Unretained(this), client, data.size()));
853 } 856 }
854 857
858 MidiManager* MidiManager::Create(MidiService* service) {
859 if (base::FeatureList::IsEnabled(features::kMidiManagerWinrt) &&
860 base::win::GetVersion() >= base::win::VERSION_WIN10)
861 return new MidiManagerWinrt(service);
862 return new DynamicallyInitializedMidiManagerWin(service);
863 }
864
855 } // namespace midi 865 } // namespace midi
OLDNEW
« no previous file with comments | « media/midi/OWNERS ('k') | media/midi/midi_manager_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698