| 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 20 matching lines...) Expand all Loading... |
| 49 double timestamp); | 51 double timestamp); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 friend class base::DeleteHelper<MIDIHost>; | 54 friend class base::DeleteHelper<MIDIHost>; |
| 53 friend class BrowserThread; | 55 friend class BrowserThread; |
| 54 | 56 |
| 55 virtual ~MIDIHost(); | 57 virtual ~MIDIHost(); |
| 56 | 58 |
| 57 int renderer_process_id_; | 59 int renderer_process_id_; |
| 58 | 60 |
| 61 // Represents if the renderer has a permission to send/receive MIDI SysEX |
| 62 // messages. |
| 63 bool sysex_allowed_; |
| 64 |
| 59 // |midi_manager_| talks to the platform-specific MIDI APIs. | 65 // |midi_manager_| talks to the platform-specific MIDI APIs. |
| 60 // It can be NULL if the platform (or our current implementation) | 66 // It can be NULL if the platform (or our current implementation) |
| 61 // does not support MIDI. If not supported then a call to | 67 // does not support MIDI. If not supported then a call to |
| 62 // OnRequestAccess() will always refuse access and a call to | 68 // OnRequestAccess() will always refuse access and a call to |
| 63 // OnSendData() will do nothing. | 69 // OnSendData() will do nothing. |
| 64 media::MIDIManager* const midi_manager_; | 70 media::MIDIManager* const midi_manager_; |
| 65 | 71 |
| 72 // Buffers where data sent from each MIDI input port is stored. |
| 73 ScopedVector<media::MIDIMessageQueue> received_messages_queues_; |
| 74 |
| 66 // The number of bytes sent to the platform-specific MIDI sending | 75 // The number of bytes sent to the platform-specific MIDI sending |
| 67 // system, but not yet completed. | 76 // system, but not yet completed. |
| 68 size_t sent_bytes_in_flight_; | 77 size_t sent_bytes_in_flight_; |
| 69 | 78 |
| 70 // The number of bytes successfully sent since the last time | 79 // The number of bytes successfully sent since the last time |
| 71 // we've acknowledged back to the renderer. | 80 // we've acknowledged back to the renderer. |
| 72 size_t bytes_sent_since_last_acknowledgement_; | 81 size_t bytes_sent_since_last_acknowledgement_; |
| 73 | 82 |
| 74 // Protects access to |sent_bytes_in_flight_|. | 83 // Protects access to |sent_bytes_in_flight_|. |
| 75 base::Lock in_flight_lock_; | 84 base::Lock in_flight_lock_; |
| 76 | 85 |
| 77 DISALLOW_COPY_AND_ASSIGN(MIDIHost); | 86 DISALLOW_COPY_AND_ASSIGN(MIDIHost); |
| 78 }; | 87 }; |
| 79 | 88 |
| 80 } // namespace content | 89 } // namespace content |
| 81 | 90 |
| 82 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 91 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
| OLD | NEW |