[Android] Remove unused code in content
[chromium-blink-merge.git] / media / midi / midi_scheduler.h
blob58de5d232864707888c9af6cf4bdc5aedbcf801f
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_MIDI_MIDI_SCHEDULER_H_
6 #define MEDIA_MIDI_MIDI_SCHEDULER_H_
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "media/midi/midi_export.h"
12 namespace media {
13 namespace midi {
15 class MidiManager;
16 class MidiManagerClient;
18 // TODO(crbug.com/467442): Make tasks cancelable per client.
19 class MIDI_EXPORT MidiScheduler final {
20 public:
21 explicit MidiScheduler(MidiManager* manager);
22 ~MidiScheduler();
24 // Post |closure| to the current message loop safely. The |closure| will not
25 // be invoked after MidiScheduler is deleted. AccumulateMidiBytesSent() of
26 // |client| is called internally.
27 void PostSendDataTask(MidiManagerClient* client,
28 size_t length,
29 double timestamp,
30 const base::Closure& closure);
32 private:
33 void InvokeClosure(MidiManagerClient* client,
34 size_t length,
35 const base::Closure& closure);
37 // MidiManager should own the MidiScheduler and be alive longer.
38 MidiManager* manager_;
39 base::WeakPtrFactory<MidiScheduler> weak_factory_;
41 DISALLOW_COPY_AND_ASSIGN(MidiScheduler);
44 } // namespace midi
45 } // namespace media
47 #endif // MEDIA_MIDI_MIDI_SCHEDULER_H_