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

Side by Side Diff: content/renderer/media/midi_message_filter.h

Issue 664843002: Web MIDI: distributes MIDIPort information asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifecycle
Patch Set: . => -> Created 6 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « content/common/media/midi_messages.h ('k') | content/renderer/media/midi_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_
6 #define CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ 6 #define CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void Send(IPC::Message* message); 60 void Send(IPC::Message* message);
61 61
62 // IPC::MessageFilter override. Called on |io_message_loop|. 62 // IPC::MessageFilter override. Called on |io_message_loop|.
63 bool OnMessageReceived(const IPC::Message& message) override; 63 bool OnMessageReceived(const IPC::Message& message) override;
64 void OnFilterAdded(IPC::Sender* sender) override; 64 void OnFilterAdded(IPC::Sender* sender) override;
65 void OnFilterRemoved() override; 65 void OnFilterRemoved() override;
66 void OnChannelClosing() override; 66 void OnChannelClosing() override;
67 67
68 // Called when the browser process has approved (or denied) access to 68 // Called when the browser process has approved (or denied) access to
69 // MIDI hardware. 69 // MIDI hardware.
70 // TODO(toyoshim): MidiPortInfoList objects should be notified separately 70 void OnSessionStarted(media::MidiResult result);
71 // port by port. 71
72 void OnSessionStarted(media::MidiResult result, 72 // These functions are called in 2 cases:
73 media::MidiPortInfoList inputs, 73 // (1) Just before calling |OnSessionStarted|, to notify the recipient about
74 media::MidiPortInfoList outputs); 74 // existing ports.
75 // (2) To notify the recipient that a new device was connected and that new
76 // ports have been created.
77 void OnAddInputPort(media::MidiPortInfo info);
78 void OnAddOutputPort(media::MidiPortInfo info);
75 79
76 // Called when the browser process has sent MIDI data containing one or 80 // Called when the browser process has sent MIDI data containing one or
77 // more messages. 81 // more messages.
78 void OnDataReceived(uint32 port, 82 void OnDataReceived(uint32 port,
79 const std::vector<uint8>& data, 83 const std::vector<uint8>& data,
80 double timestamp); 84 double timestamp);
81 85
82 // From time-to-time, the browser incrementally informs us of how many bytes 86 // From time-to-time, the browser incrementally informs us of how many bytes
83 // it has successfully sent. This is part of our throttling process to avoid 87 // it has successfully sent. This is part of our throttling process to avoid
84 // sending too much data before knowing how much has already been sent. 88 // sending too much data before knowing how much has already been sent.
85 void OnAcknowledgeSentData(size_t bytes_sent); 89 void OnAcknowledgeSentData(size_t bytes_sent);
86 90
87 // Following methods, Handle*, run on |main_message_loop_|. 91 // Following methods, Handle*, run on |main_message_loop_|.
88 void HandleClientAdded(media::MidiResult result); 92 void HandleClientAdded(media::MidiResult result);
89 93
94 void HandleAddInputPort(media::MidiPortInfo info);
95 void HandleAddOutputPort(media::MidiPortInfo info);
96
90 void HandleDataReceived(uint32 port, 97 void HandleDataReceived(uint32 port,
91 const std::vector<uint8>& data, 98 const std::vector<uint8>& data,
92 double timestamp); 99 double timestamp);
93 100
94 void HandleAckknowledgeSentData(size_t bytes_sent); 101 void HandleAckknowledgeSentData(size_t bytes_sent);
95 102
96 // IPC sender for Send(); must only be accessed on |io_message_loop_|. 103 // IPC sender for Send(); must only be accessed on |io_message_loop_|.
97 IPC::Sender* sender_; 104 IPC::Sender* sender_;
98 105
99 // Message loop on which IPC calls are driven. 106 // Message loop on which IPC calls are driven.
(...skipping 22 matching lines...) Expand all
122 media::MidiPortInfoList outputs_; 129 media::MidiPortInfoList outputs_;
123 130
124 size_t unacknowledged_bytes_sent_; 131 size_t unacknowledged_bytes_sent_;
125 132
126 DISALLOW_COPY_AND_ASSIGN(MidiMessageFilter); 133 DISALLOW_COPY_AND_ASSIGN(MidiMessageFilter);
127 }; 134 };
128 135
129 } // namespace content 136 } // namespace content
130 137
131 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ 138 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « content/common/media/midi_messages.h ('k') | content/renderer/media/midi_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698