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

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

Issue 108603004: [WebMIDI] MIDIManager::create should return non-null object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 | no next file » | 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 #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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 #if !defined(OS_MACOSX) && !defined(OS_WIN) 12 #if !defined(OS_MACOSX) && !defined(OS_WIN)
13 namespace {
14
15 class NullMIDIManager : public MIDIManager {
Takashi Toyoshima 2013/12/19 07:58:24 How about just adding default implementations of I
yhirano 2013/12/19 08:21:54 Done.
16 public:
17 virtual ~NullMIDIManager();
18 virtual void DispatchSendMIDIData(MIDIManagerClient* client,
19 uint32 port_index,
20 const std::vector<uint8>& data,
21 double timestamp) OVERRIDE;
22 virtual bool Initialize() OVERRIDE;
23 };
24
25 NullMIDIManager::~NullMIDIManager() {}
26
27 void NullMIDIManager::DispatchSendMIDIData(MIDIManagerClient* client,
28 uint32 port_index,
29 const std::vector<uint8>& data,
30 double timestamp) {}
31
32 bool NullMIDIManager::Initialize() {
33 return false;
34 }
35
36 } // namespace
37
13 // TODO(crogers): implement MIDIManager for other platforms. 38 // TODO(crogers): implement MIDIManager for other platforms.
14 MIDIManager* MIDIManager::Create() { 39 MIDIManager* MIDIManager::Create() {
15 return NULL; 40 return new NullMIDIManager;
16 } 41 }
17 #endif 42 #endif
18 43
19 MIDIManager::MIDIManager() 44 MIDIManager::MIDIManager()
20 : initialized_(false) { 45 : initialized_(false) {
21 } 46 }
22 47
23 MIDIManager::~MIDIManager() { 48 MIDIManager::~MIDIManager() {
24 } 49 }
25 50
(...skipping 30 matching lines...) Expand all
56 const uint8* data, 81 const uint8* data,
57 size_t length, 82 size_t length,
58 double timestamp) { 83 double timestamp) {
59 base::AutoLock auto_lock(clients_lock_); 84 base::AutoLock auto_lock(clients_lock_);
60 85
61 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) 86 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i)
62 (*i)->ReceiveMIDIData(port_index, data, length, timestamp); 87 (*i)->ReceiveMIDIData(port_index, data, length, timestamp);
63 } 88 }
64 89
65 } // namespace media 90 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698