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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_vector.h" | |
18 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
19 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
20 #include "content/public/browser/browser_message_filter.h" | 19 #include "content/public/browser/browser_message_filter.h" |
21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
22 #include "media/midi/midi_manager.h" | 21 #include "media/midi/midi_manager.h" |
23 #include "media/midi/midi_port_info.h" | 22 #include "media/midi/midi_port_info.h" |
24 #include "media/midi/midi_service.mojom.h" | 23 #include "media/midi/midi_service.mojom.h" |
25 | 24 |
26 namespace midi { | 25 namespace midi { |
27 class MidiService; | 26 class MidiService; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 bool has_sys_ex_permission_; | 77 bool has_sys_ex_permission_; |
79 | 78 |
80 // Represents if a session is requested to start. | 79 // Represents if a session is requested to start. |
81 bool is_session_requested_; | 80 bool is_session_requested_; |
82 | 81 |
83 // |midi_service_| manages a MidiManager instance that talks to | 82 // |midi_service_| manages a MidiManager instance that talks to |
84 // platform-specific MIDI APIs. It can be nullptr after detached. | 83 // platform-specific MIDI APIs. It can be nullptr after detached. |
85 midi::MidiService* midi_service_; | 84 midi::MidiService* midi_service_; |
86 | 85 |
87 // Buffers where data sent from each MIDI input port is stored. | 86 // Buffers where data sent from each MIDI input port is stored. |
88 ScopedVector<midi::MidiMessageQueue> received_messages_queues_; | 87 std::vector<std::unique_ptr<midi::MidiMessageQueue>> |
| 88 received_messages_queues_; |
89 | 89 |
90 // Protects access to |received_messages_queues_|; | 90 // Protects access to |received_messages_queues_|; |
91 base::Lock messages_queues_lock_; | 91 base::Lock messages_queues_lock_; |
92 | 92 |
93 // The number of bytes sent to the platform-specific MIDI sending | 93 // The number of bytes sent to the platform-specific MIDI sending |
94 // system, but not yet completed. | 94 // system, but not yet completed. |
95 size_t sent_bytes_in_flight_; | 95 size_t sent_bytes_in_flight_; |
96 | 96 |
97 // The number of bytes successfully sent since the last time | 97 // The number of bytes successfully sent since the last time |
98 // we've acknowledged back to the renderer. | 98 // we've acknowledged back to the renderer. |
99 size_t bytes_sent_since_last_acknowledgement_; | 99 size_t bytes_sent_since_last_acknowledgement_; |
100 | 100 |
101 // Protects access to |sent_bytes_in_flight_|. | 101 // Protects access to |sent_bytes_in_flight_|. |
102 base::Lock in_flight_lock_; | 102 base::Lock in_flight_lock_; |
103 | 103 |
104 // How many output port exists. | 104 // How many output port exists. |
105 uint32_t output_port_count_; | 105 uint32_t output_port_count_; |
106 | 106 |
107 // Protects access to |output_port_count_|. | 107 // Protects access to |output_port_count_|. |
108 base::Lock output_port_count_lock_; | 108 base::Lock output_port_count_lock_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(MidiHost); | 110 DISALLOW_COPY_AND_ASSIGN(MidiHost); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace content | 113 } // namespace content |
114 | 114 |
115 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 115 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
OLD | NEW |