OLD | NEW |
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 CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 // Called from UI thread from the owner of this object. | 31 // Called from UI thread from the owner of this object. |
32 MidiHost(int renderer_process_id, media::MidiManager* midi_manager); | 32 MidiHost(int renderer_process_id, media::MidiManager* midi_manager); |
33 | 33 |
34 // BrowserMessageFilter implementation. | 34 // BrowserMessageFilter implementation. |
35 void OnDestruct() const override; | 35 void OnDestruct() const override; |
36 bool OnMessageReceived(const IPC::Message& message) override; | 36 bool OnMessageReceived(const IPC::Message& message) override; |
37 | 37 |
38 // MidiManagerClient implementation. | 38 // MidiManagerClient implementation. |
39 void CompleteStartSession(media::MidiResult result) override; | 39 void CompleteStartSession(media::MidiResult result) override; |
| 40 void AddInputPort(const media::MidiPortInfo& info) override; |
| 41 void AddOutputPort(const media::MidiPortInfo& info) override; |
40 void ReceiveMidiData(uint32 port, | 42 void ReceiveMidiData(uint32 port, |
41 const uint8* data, | 43 const uint8* data, |
42 size_t length, | 44 size_t length, |
43 double timestamp) override; | 45 double timestamp) override; |
44 void AccumulateMidiBytesSent(size_t n) override; | 46 void AccumulateMidiBytesSent(size_t n) override; |
45 | 47 |
46 // Start session to access MIDI hardware. | 48 // Start session to access MIDI hardware. |
47 void OnStartSession(); | 49 void OnStartSession(); |
48 | 50 |
49 // Data to be sent to a MIDI output port. | 51 // Data to be sent to a MIDI output port. |
(...skipping 29 matching lines...) Expand all Loading... |
79 // |midi_manager_| talks to the platform-specific MIDI APIs. | 81 // |midi_manager_| talks to the platform-specific MIDI APIs. |
80 // It can be NULL if the platform (or our current implementation) | 82 // It can be NULL if the platform (or our current implementation) |
81 // does not support MIDI. If not supported then a call to | 83 // does not support MIDI. If not supported then a call to |
82 // OnRequestAccess() will always refuse access and a call to | 84 // OnRequestAccess() will always refuse access and a call to |
83 // OnSendData() will do nothing. | 85 // OnSendData() will do nothing. |
84 media::MidiManager* const midi_manager_; | 86 media::MidiManager* const midi_manager_; |
85 | 87 |
86 // Buffers where data sent from each MIDI input port is stored. | 88 // Buffers where data sent from each MIDI input port is stored. |
87 ScopedVector<media::MidiMessageQueue> received_messages_queues_; | 89 ScopedVector<media::MidiMessageQueue> received_messages_queues_; |
88 | 90 |
| 91 // Protects access to |received_messages_queues_|; |
| 92 base::Lock messages_queues_lock_; |
| 93 |
89 // The number of bytes sent to the platform-specific MIDI sending | 94 // The number of bytes sent to the platform-specific MIDI sending |
90 // system, but not yet completed. | 95 // system, but not yet completed. |
91 size_t sent_bytes_in_flight_; | 96 size_t sent_bytes_in_flight_; |
92 | 97 |
93 // The number of bytes successfully sent since the last time | 98 // The number of bytes successfully sent since the last time |
94 // we've acknowledged back to the renderer. | 99 // we've acknowledged back to the renderer. |
95 size_t bytes_sent_since_last_acknowledgement_; | 100 size_t bytes_sent_since_last_acknowledgement_; |
96 | 101 |
97 // Protects access to |sent_bytes_in_flight_|. | 102 // Protects access to |sent_bytes_in_flight_|. |
98 base::Lock in_flight_lock_; | 103 base::Lock in_flight_lock_; |
99 | 104 |
100 DISALLOW_COPY_AND_ASSIGN(MidiHost); | 105 DISALLOW_COPY_AND_ASSIGN(MidiHost); |
101 }; | 106 }; |
102 | 107 |
103 } // namespace content | 108 } // namespace content |
104 | 109 |
105 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 110 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
OLD | NEW |