| 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 |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 } | 948 } |
| 949 | 949 |
| 950 void MidiManagerWinrt::InitializeOnComThread() { | 950 void MidiManagerWinrt::InitializeOnComThread() { |
| 951 base::AutoLock auto_lock(lazy_init_member_lock_); | 951 base::AutoLock auto_lock(lazy_init_member_lock_); |
| 952 | 952 |
| 953 com_thread_checker_.reset(new base::ThreadChecker); | 953 com_thread_checker_.reset(new base::ThreadChecker); |
| 954 | 954 |
| 955 if (!g_combase_functions.Get().LoadFunctions()) { | 955 if (!g_combase_functions.Get().LoadFunctions()) { |
| 956 VLOG(1) << "Failed loading functions from combase.dll: " | 956 VLOG(1) << "Failed loading functions from combase.dll: " |
| 957 << PrintHr(HRESULT_FROM_WIN32(GetLastError())); | 957 << PrintHr(HRESULT_FROM_WIN32(GetLastError())); |
| 958 CompleteInitialization(Result::INITIALIZATION_ERROR); | 958 CompleteInitialization(mojom::Result::INITIALIZATION_ERROR); |
| 959 return; | 959 return; |
| 960 } | 960 } |
| 961 | 961 |
| 962 port_manager_in_.reset(new MidiInPortManager(this)); | 962 port_manager_in_.reset(new MidiInPortManager(this)); |
| 963 port_manager_out_.reset(new MidiOutPortManager(this)); | 963 port_manager_out_.reset(new MidiOutPortManager(this)); |
| 964 | 964 |
| 965 scheduler_.reset(new MidiScheduler(this)); | 965 scheduler_.reset(new MidiScheduler(this)); |
| 966 | 966 |
| 967 if (!(port_manager_in_->StartWatcher() && | 967 if (!(port_manager_in_->StartWatcher() && |
| 968 port_manager_out_->StartWatcher())) { | 968 port_manager_out_->StartWatcher())) { |
| 969 port_manager_in_->StopWatcher(); | 969 port_manager_in_->StopWatcher(); |
| 970 port_manager_out_->StopWatcher(); | 970 port_manager_out_->StopWatcher(); |
| 971 CompleteInitialization(Result::INITIALIZATION_ERROR); | 971 CompleteInitialization(mojom::Result::INITIALIZATION_ERROR); |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 | 974 |
| 975 void MidiManagerWinrt::FinalizeOnComThread() { | 975 void MidiManagerWinrt::FinalizeOnComThread() { |
| 976 base::AutoLock auto_lock(lazy_init_member_lock_); | 976 base::AutoLock auto_lock(lazy_init_member_lock_); |
| 977 | 977 |
| 978 DCHECK(com_thread_checker_->CalledOnValidThread()); | 978 DCHECK(com_thread_checker_->CalledOnValidThread()); |
| 979 | 979 |
| 980 scheduler_.reset(); | 980 scheduler_.reset(); |
| 981 | 981 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 VLOG(1) << "SendBuffer failed: " << PrintHr(hr); | 1034 VLOG(1) << "SendBuffer failed: " << PrintHr(hr); |
| 1035 return; | 1035 return; |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 void MidiManagerWinrt::OnPortManagerReady() { | 1039 void MidiManagerWinrt::OnPortManagerReady() { |
| 1040 DCHECK(com_thread_checker_->CalledOnValidThread()); | 1040 DCHECK(com_thread_checker_->CalledOnValidThread()); |
| 1041 DCHECK(port_manager_ready_count_ < 2); | 1041 DCHECK(port_manager_ready_count_ < 2); |
| 1042 | 1042 |
| 1043 if (++port_manager_ready_count_ == 2) | 1043 if (++port_manager_ready_count_ == 2) |
| 1044 CompleteInitialization(Result::OK); | 1044 CompleteInitialization(mojom::Result::OK); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 } // namespace midi | 1047 } // namespace midi |
| OLD | NEW |