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

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

Issue 324143002: Decouple IPC::MessageFilter from IPC::Channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing Created 6 years, 6 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 | Annotate | Revision Log
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 <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // IO message loop associated with this message filter. 44 // IO message loop associated with this message filter.
45 scoped_refptr<base::MessageLoopProxy> io_message_loop() const { 45 scoped_refptr<base::MessageLoopProxy> io_message_loop() const {
46 return io_message_loop_; 46 return io_message_loop_;
47 } 47 }
48 48
49 protected: 49 protected:
50 virtual ~MidiMessageFilter(); 50 virtual ~MidiMessageFilter();
51 51
52 private: 52 private:
53 // Sends an IPC message using |channel_|. 53 // Sends an IPC message using |sender_|.
54 void Send(IPC::Message* message); 54 void Send(IPC::Message* message);
55 55
56 // IPC::MessageFilter override. Called on |io_message_loop|. 56 // IPC::MessageFilter override. Called on |io_message_loop|.
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
58 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; 58 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE;
59 virtual void OnFilterRemoved() OVERRIDE; 59 virtual void OnFilterRemoved() OVERRIDE;
60 virtual void OnChannelClosing() OVERRIDE; 60 virtual void OnChannelClosing() OVERRIDE;
61 61
62 // Called when the browser process has approved (or denied) access to 62 // Called when the browser process has approved (or denied) access to
63 // MIDI hardware. 63 // MIDI hardware.
64 void OnSessionStarted(int client_id, 64 void OnSessionStarted(int client_id,
65 media::MidiResult result, 65 media::MidiResult result,
66 media::MidiPortInfoList inputs, 66 media::MidiPortInfoList inputs,
67 media::MidiPortInfoList outputs); 67 media::MidiPortInfoList outputs);
68 68
(...skipping 18 matching lines...) Expand all
87 double timestamp); 87 double timestamp);
88 88
89 void StartSessionOnIOThread(int client_id); 89 void StartSessionOnIOThread(int client_id);
90 90
91 void SendMidiDataOnIOThread(uint32 port, 91 void SendMidiDataOnIOThread(uint32 port,
92 const std::vector<uint8>& data, 92 const std::vector<uint8>& data,
93 double timestamp); 93 double timestamp);
94 94
95 blink::WebMIDIAccessorClient* GetClientFromId(int client_id); 95 blink::WebMIDIAccessorClient* GetClientFromId(int client_id);
96 96
97 // IPC channel for Send(); must only be accessed on |io_message_loop_|. 97 // IPC sender for Send(); must only be accessed on |io_message_loop_|.
98 IPC::Channel* channel_; 98 IPC::Sender* sender_;
99 99
100 // Message loop on which IPC calls are driven. 100 // Message loop on which IPC calls are driven.
101 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; 101 const scoped_refptr<base::MessageLoopProxy> io_message_loop_;
102 102
103 // Main thread's message loop. 103 // Main thread's message loop.
104 scoped_refptr<base::MessageLoopProxy> main_message_loop_; 104 scoped_refptr<base::MessageLoopProxy> main_message_loop_;
105 105
106 // Keeps track of all MIDI clients. 106 // Keeps track of all MIDI clients.
107 // We map client to "client id" used to track permission. 107 // We map client to "client id" used to track permission.
108 // When access has been approved, we add the input and output ports to 108 // When access has been approved, we add the input and output ports to
109 // the client, allowing it to actually receive and send MIDI data. 109 // the client, allowing it to actually receive and send MIDI data.
110 typedef std::map<blink::WebMIDIAccessorClient*, int> ClientsMap; 110 typedef std::map<blink::WebMIDIAccessorClient*, int> ClientsMap;
111 ClientsMap clients_; 111 ClientsMap clients_;
112 112
113 // Dishes out client ids. 113 // Dishes out client ids.
114 int next_available_id_; 114 int next_available_id_;
115 115
116 size_t unacknowledged_bytes_sent_; 116 size_t unacknowledged_bytes_sent_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(MidiMessageFilter); 118 DISALLOW_COPY_AND_ASSIGN(MidiMessageFilter);
119 }; 119 };
120 120
121 } // namespace content 121 } // namespace content
122 122
123 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ 123 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/audio_message_filter.cc ('k') | content/renderer/media/midi_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698