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

Side by Side Diff: media/midi/midi_manager.h

Issue 2443113002: Fix possible multiple calls to MidiManager::StartInitialization() in StartSession() (Closed)
Patch Set: comment Created 4 years, 1 month 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 | « no previous file | media/midi/midi_manager.cc » ('j') | media/midi/midi_manager.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_ 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_
6 #define MEDIA_MIDI_MIDI_MANAGER_H_ 6 #define MEDIA_MIDI_MIDI_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 typedef std::set<MidiManagerClient*> ClientSet; 183 typedef std::set<MidiManagerClient*> ClientSet;
184 ClientSet clients_; 184 ClientSet clients_;
185 185
186 // Keeps track of all clients who are waiting for CompleteStartSession(). 186 // Keeps track of all clients who are waiting for CompleteStartSession().
187 ClientSet pending_clients_; 187 ClientSet pending_clients_;
188 188
189 // Keeps a SingleThreadTaskRunner of the thread that calls StartSession in 189 // Keeps a SingleThreadTaskRunner of the thread that calls StartSession in
190 // order to invoke CompleteStartSession() on the thread. 190 // order to invoke CompleteStartSession() on the thread.
191 scoped_refptr<base::SingleThreadTaskRunner> session_thread_runner_; 191 scoped_refptr<base::SingleThreadTaskRunner> session_thread_runner_;
192 192
193 // Keeps true if platform dependent initialization is already completed. 193 enum class InitializationState {
Takashi Toyoshima 2016/10/24 10:07:29 https://google.github.io/styleguide/cppguide.html#
Shao-Chuan Lee 2016/10/24 10:09:38 Done.
194 bool initialized_; 194 NOT_STARTED,
195 STARTED,
196 COMPLETED,
197 };
198
199 // Tracks platform dependent initialization state.
200 InitializationState initialization_state_;
195 201
196 // Keeps false until Finalize() is called. 202 // Keeps false until Finalize() is called.
197 bool finalized_; 203 bool finalized_;
198 204
199 // Keeps the platform dependent initialization result if initialization is 205 // Keeps the platform dependent initialization result if initialization is
200 // completed. Otherwise keeps mojom::Result::NOT_INITIALIZED. 206 // completed. Otherwise keeps mojom::Result::NOT_INITIALIZED.
201 mojom::Result result_; 207 mojom::Result result_;
202 208
203 // Keeps all MidiPortInfo. 209 // Keeps all MidiPortInfo.
204 MidiPortInfoList input_ports_; 210 MidiPortInfoList input_ports_;
205 MidiPortInfoList output_ports_; 211 MidiPortInfoList output_ports_;
206 212
207 // Protects access to |clients_|, |pending_clients_|, 213 // Protects access to |clients_|, |pending_clients_|,
208 // |session_thread_runner_|, |initialized_|, |finalize_|, |result_|, 214 // |session_thread_runner_|, |initialization_state_|, |finalize_|, |result_|,
209 // |input_ports_| and |output_ports_|. 215 // |input_ports_| and |output_ports_|.
210 base::Lock lock_; 216 base::Lock lock_;
211 217
212 DISALLOW_COPY_AND_ASSIGN(MidiManager); 218 DISALLOW_COPY_AND_ASSIGN(MidiManager);
213 }; 219 };
214 220
215 } // namespace midi 221 } // namespace midi
216 222
217 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ 223 #endif // MEDIA_MIDI_MIDI_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | media/midi/midi_manager.cc » ('j') | media/midi/midi_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698