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_manager_winrt.h" | 5 #include "media/midi/midi_manager_winrt.h" |
6 | 6 |
7 #pragma warning(disable : 4467) | 7 #pragma warning(disable : 4467) |
8 | 8 |
9 #include <initguid.h> // Required by <devpkey.h> | 9 #include <initguid.h> // Required by <devpkey.h> |
10 | 10 |
11 #include <cfgmgr32.h> | 11 #include <cfgmgr32.h> |
12 #include <comdef.h> | 12 #include <comdef.h> |
13 #include <devpkey.h> | 13 #include <devpkey.h> |
| 14 #include <objbase.h> |
14 #include <robuffer.h> | 15 #include <robuffer.h> |
15 #include <windows.devices.enumeration.h> | 16 #include <windows.devices.enumeration.h> |
16 #include <windows.devices.midi.h> | 17 #include <windows.devices.midi.h> |
17 #include <wrl/event.h> | 18 #include <wrl/event.h> |
18 | 19 |
19 #include <iomanip> | 20 #include <iomanip> |
20 #include <unordered_map> | 21 #include <unordered_map> |
21 #include <unordered_set> | 22 #include <unordered_set> |
22 | 23 |
23 #include "base/bind.h" | 24 #include "base/bind.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ScopedComPtr<InterfaceType> WrlStaticsFactory() { | 169 ScopedComPtr<InterfaceType> WrlStaticsFactory() { |
169 ScopedComPtr<InterfaceType> com_ptr; | 170 ScopedComPtr<InterfaceType> com_ptr; |
170 | 171 |
171 ScopedHString class_id_hstring(runtime_class_id); | 172 ScopedHString class_id_hstring(runtime_class_id); |
172 if (!class_id_hstring.is_valid()) { | 173 if (!class_id_hstring.is_valid()) { |
173 com_ptr = nullptr; | 174 com_ptr = nullptr; |
174 return com_ptr; | 175 return com_ptr; |
175 } | 176 } |
176 | 177 |
177 HRESULT hr = GetCombaseFunctions()->RoGetActivationFactory( | 178 HRESULT hr = GetCombaseFunctions()->RoGetActivationFactory( |
178 class_id_hstring.get(), __uuidof(InterfaceType), com_ptr.ReceiveVoid()); | 179 class_id_hstring.get(), IID_PPV_ARGS(&com_ptr)); |
179 if (FAILED(hr)) { | 180 if (FAILED(hr)) { |
180 VLOG(1) << "RoGetActivationFactory failed: " << PrintHr(hr); | 181 VLOG(1) << "RoGetActivationFactory failed: " << PrintHr(hr); |
181 com_ptr = nullptr; | 182 com_ptr = nullptr; |
182 } | 183 } |
183 | 184 |
184 return com_ptr; | 185 return com_ptr; |
185 } | 186 } |
186 | 187 |
187 std::string HStringToString(HSTRING hstr) { | 188 std::string HStringToString(HSTRING hstr) { |
188 // Note: empty HSTRINGs are represent as nullptr, and instantiating | 189 // Note: empty HSTRINGs are represent as nullptr, and instantiating |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 | 1042 |
1042 void MidiManagerWinrt::OnPortManagerReady() { | 1043 void MidiManagerWinrt::OnPortManagerReady() { |
1043 DCHECK(com_thread_checker_->CalledOnValidThread()); | 1044 DCHECK(com_thread_checker_->CalledOnValidThread()); |
1044 DCHECK(port_manager_ready_count_ < 2); | 1045 DCHECK(port_manager_ready_count_ < 2); |
1045 | 1046 |
1046 if (++port_manager_ready_count_ == 2) | 1047 if (++port_manager_ready_count_ == 2) |
1047 CompleteInitialization(Result::OK); | 1048 CompleteInitialization(Result::OK); |
1048 } | 1049 } |
1049 | 1050 |
1050 } // namespace midi | 1051 } // namespace midi |
OLD | NEW |