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

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

Issue 323323002: Web MIDI: MidiManager crashes if a session is ended while initializing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make_pair Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/midi/midi_manager.cc » ('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 (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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 private: 147 private:
148 void CompleteInitializationInternal(MidiResult result); 148 void CompleteInitializationInternal(MidiResult result);
149 149
150 // Keeps track of all clients who wish to receive MIDI data. 150 // Keeps track of all clients who wish to receive MIDI data.
151 typedef std::set<MidiManagerClient*> ClientList; 151 typedef std::set<MidiManagerClient*> ClientList;
152 ClientList clients_; 152 ClientList clients_;
153 153
154 // Keeps track of all clients who are waiting for CompleteStartSession(). 154 // Keeps track of all clients who are waiting for CompleteStartSession().
155 typedef std::map<int, MidiManagerClient*> PendingClientMap; 155 typedef std::multimap<MidiManagerClient*, int> PendingClientMap;
156 PendingClientMap pending_clients_; 156 PendingClientMap pending_clients_;
157 157
158 // Keeps a SingleThreadTaskRunner of the thread that calls StartSession in 158 // Keeps a SingleThreadTaskRunner of the thread that calls StartSession in
159 // order to invoke CompleteStartSession() on the thread. 159 // order to invoke CompleteStartSession() on the thread.
160 scoped_refptr<base::SingleThreadTaskRunner> session_thread_runner_; 160 scoped_refptr<base::SingleThreadTaskRunner> session_thread_runner_;
161 161
162 // Keeps true if platform dependent initialization is already completed. 162 // Keeps true if platform dependent initialization is already completed.
163 bool initialized_; 163 bool initialized_;
164 164
165 // Keeps the platform dependent initialization result if initialization is 165 // Keeps the platform dependent initialization result if initialization is
166 // completed. Otherwise keeps MIDI_NOT_SUPPORTED. 166 // completed. Otherwise keeps MIDI_NOT_SUPPORTED.
167 MidiResult result_; 167 MidiResult result_;
168 168
169 // Protects access to |clients_|, |pending_clients_|, |initialized_|, and 169 // Protects access to |clients_|, |pending_clients_|, |initialized_|, and
170 // |result_|. 170 // |result_|.
171 base::Lock lock_; 171 base::Lock lock_;
172 172
173 MidiPortInfoList input_ports_; 173 MidiPortInfoList input_ports_;
174 MidiPortInfoList output_ports_; 174 MidiPortInfoList output_ports_;
175 175
176 DISALLOW_COPY_AND_ASSIGN(MidiManager); 176 DISALLOW_COPY_AND_ASSIGN(MidiManager);
177 }; 177 };
178 178
179 } // namespace media 179 } // namespace media
180 180
181 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ 181 #endif // MEDIA_MIDI_MIDI_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | media/midi/midi_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698