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

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

Issue 2170463003: Web MIDI: Add CHECK()s to ensure MidiManager owned threads are terminated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | media/midi/midi_manager_alsa.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 #include "media/midi/midi_manager.h" 5 #include "media/midi/midi_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } // namespace 53 } // namespace
54 54
55 MidiManager::MidiManager() 55 MidiManager::MidiManager()
56 : initialized_(false), finalized_(false), result_(Result::NOT_INITIALIZED) { 56 : initialized_(false), finalized_(false), result_(Result::NOT_INITIALIZED) {
57 ReportUsage(Usage::CREATED); 57 ReportUsage(Usage::CREATED);
58 } 58 }
59 59
60 MidiManager::~MidiManager() { 60 MidiManager::~MidiManager() {
61 // Make sure that Finalize() is called to clean up resources allocated on 61 // Make sure that Finalize() is called to clean up resources allocated on
62 // the Chrome_IOThread. 62 // the Chrome_IOThread.
63 DCHECK(finalized_); 63 CHECK(finalized_);
Adam Goode 2016/07/21 15:40:30 Do you need to take lock_ here?
Takashi Toyoshima 2016/07/21 18:25:24 Good point. I'll fix this.
64 } 64 }
65 65
66 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \ 66 #if !defined(OS_MACOSX) && !defined(OS_WIN) && \
67 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID) 67 !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID)
68 MidiManager* MidiManager::Create() { 68 MidiManager* MidiManager::Create() {
69 ReportUsage(Usage::CREATED_ON_UNSUPPORTED_PLATFORMS); 69 ReportUsage(Usage::CREATED_ON_UNSUPPORTED_PLATFORMS);
70 return new MidiManager; 70 return new MidiManager;
71 } 71 }
72 #endif 72 #endif
73 73
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 base::AutoLock auto_lock(lock_); 267 base::AutoLock auto_lock(lock_);
268 finalized_ = true; 268 finalized_ = true;
269 269
270 // Detach all clients so that they do not call MidiManager methods any more. 270 // Detach all clients so that they do not call MidiManager methods any more.
271 for (auto* client : clients_) 271 for (auto* client : clients_)
272 client->Detach(); 272 client->Detach();
273 } 273 }
274 274
275 } // namespace midi 275 } // namespace midi
276 } // namespace media 276 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | media/midi/midi_manager_alsa.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698