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_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "media/midi/midi_manager.h" | 16 #include "media/midi/midi_manager.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 class MIDIManager; | 19 class MIDIManager; |
| 20 class MIDIMessageQueue; |
19 } | 21 } |
20 | 22 |
21 namespace content { | 23 namespace content { |
22 | 24 |
23 class CONTENT_EXPORT MIDIHost | 25 class CONTENT_EXPORT MIDIHost |
24 : public BrowserMessageFilter, | 26 : public BrowserMessageFilter, |
25 public media::MIDIManagerClient { | 27 public media::MIDIManagerClient { |
26 public: | 28 public: |
27 // Called from UI thread from the owner of this object. | 29 // Called from UI thread from the owner of this object. |
28 MIDIHost(int renderer_process_id, media::MIDIManager* midi_manager); | 30 MIDIHost(int renderer_process_id, media::MIDIManager* midi_manager); |
(...skipping 27 matching lines...) Expand all Loading... |
56 | 58 |
57 int renderer_process_id_; | 59 int renderer_process_id_; |
58 | 60 |
59 // |midi_manager_| talks to the platform-specific MIDI APIs. | 61 // |midi_manager_| talks to the platform-specific MIDI APIs. |
60 // It can be NULL if the platform (or our current implementation) | 62 // It can be NULL if the platform (or our current implementation) |
61 // does not support MIDI. If not supported then a call to | 63 // does not support MIDI. If not supported then a call to |
62 // OnRequestAccess() will always refuse access and a call to | 64 // OnRequestAccess() will always refuse access and a call to |
63 // OnSendData() will do nothing. | 65 // OnSendData() will do nothing. |
64 media::MIDIManager* const midi_manager_; | 66 media::MIDIManager* const midi_manager_; |
65 | 67 |
| 68 // Buffers where data sent from each MIDI input port is stored. |
| 69 ScopedVector<media::MIDIMessageQueue> received_messages_queues_; |
| 70 |
66 // The number of bytes sent to the platform-specific MIDI sending | 71 // The number of bytes sent to the platform-specific MIDI sending |
67 // system, but not yet completed. | 72 // system, but not yet completed. |
68 size_t sent_bytes_in_flight_; | 73 size_t sent_bytes_in_flight_; |
69 | 74 |
70 // The number of bytes successfully sent since the last time | 75 // The number of bytes successfully sent since the last time |
71 // we've acknowledged back to the renderer. | 76 // we've acknowledged back to the renderer. |
72 size_t bytes_sent_since_last_acknowledgement_; | 77 size_t bytes_sent_since_last_acknowledgement_; |
73 | 78 |
74 // Protects access to |sent_bytes_in_flight_|. | 79 // Protects access to |sent_bytes_in_flight_|. |
75 base::Lock in_flight_lock_; | 80 base::Lock in_flight_lock_; |
76 | 81 |
77 DISALLOW_COPY_AND_ASSIGN(MIDIHost); | 82 DISALLOW_COPY_AND_ASSIGN(MIDIHost); |
78 }; | 83 }; |
79 | 84 |
80 } // namespace content | 85 } // namespace content |
81 | 86 |
82 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 87 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
OLD | NEW |