Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: content/browser/renderer_host/media/midi_host.h

Issue 68353002: Use MIDIMessageQueue/IsValidWebMIDIData for MIDI byte stream validation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary notation from a header comment, to address scherkus' comment. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/midi_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/midi_host.h
diff --git a/content/browser/renderer_host/media/midi_host.h b/content/browser/renderer_host/media/midi_host.h
index e3b9df1b6bea56f7bc113c223e48c51d18d3974c..153863fe603a748312ce75c1545d9b04305cfd39 100644
--- a/content/browser/renderer_host/media/midi_host.h
+++ b/content/browser/renderer_host/media/midi_host.h
@@ -7,8 +7,10 @@
#include <vector>
+#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
@@ -16,6 +18,7 @@
namespace media {
class MIDIManager;
+class MIDIMessageQueue;
}
namespace content {
@@ -33,11 +36,10 @@ class CONTENT_EXPORT MIDIHost
bool* message_was_ok) OVERRIDE;
// MIDIManagerClient implementation.
- virtual void ReceiveMIDIData(
- uint32 port,
- const uint8* data,
- size_t length,
- double timestamp) OVERRIDE;
+ virtual void ReceiveMIDIData(uint32 port,
+ const uint8* data,
+ size_t length,
+ double timestamp) OVERRIDE;
virtual void AccumulateMIDIBytesSent(size_t n) OVERRIDE;
// Start session to access MIDI hardware.
@@ -49,13 +51,25 @@ class CONTENT_EXPORT MIDIHost
double timestamp);
private:
+ FRIEND_TEST_ALL_PREFIXES(MIDIHostTest, IsValidWebMIDIData);
friend class base::DeleteHelper<MIDIHost>;
friend class BrowserThread;
virtual ~MIDIHost();
+ // Returns true if |data| fulfills the requirements of MIDIOutput.send API
+ // defined in the WebMIDI spec.
+ // - |data| must be any number of complete MIDI messages (data abbreviation
+ // called "running status" is disallowed).
+ // - 1-byte MIDI realtime messages can be placed at any position of |data|.
+ static bool IsValidWebMIDIData(const std::vector<uint8>& data);
+
int renderer_process_id_;
+ // Represents if the renderer has a permission to send/receive MIDI SysEX
+ // messages.
+ bool has_sys_ex_permission_;
+
// |midi_manager_| talks to the platform-specific MIDI APIs.
// It can be NULL if the platform (or our current implementation)
// does not support MIDI. If not supported then a call to
@@ -63,6 +77,9 @@ class CONTENT_EXPORT MIDIHost
// OnSendData() will do nothing.
media::MIDIManager* const midi_manager_;
+ // Buffers where data sent from each MIDI input port is stored.
+ ScopedVector<media::MIDIMessageQueue> received_messages_queues_;
+
// The number of bytes sent to the platform-specific MIDI sending
// system, but not yet completed.
size_t sent_bytes_in_flight_;
« no previous file with comments | « no previous file | content/browser/renderer_host/media/midi_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698