diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 07:05:47 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 07:05:47 +0000 |
commit | 6e068ea00ea6f687f90c7245533368423cc3933f (patch) | |
tree | 70d19db05a0564f93e81ba7e55822af88c4b585b /content/renderer | |
parent | eade06d5228433c3e7cfa19dfeebce7f9620d194 (diff) | |
download | chromium_src-6e068ea00ea6f687f90c7245533368423cc3933f.zip chromium_src-6e068ea00ea6f687f90c7245533368423cc3933f.tar.gz chromium_src-6e068ea00ea6f687f90c7245533368423cc3933f.tar.bz2 |
Web MIDI: make naming convention be consistent
Naming cleanup based on following rules:
- MidiFooBar ... use this style to be consistent with chromium
- WebMIDIFooBar ... Web API name related things, or names in blink
- MIDIFooBar ... APIs and structures defined by each operating systems
Other cleanup:
- Modify some TODO(crogers) to TODO(toyoshim)
- Add some crbug links.
- Remove some obsolete UI TODOs related to infobars
BUG=none
TEST=build for all platforms
Review URL: https://codereview.chromium.org/151343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/media/midi_dispatcher.cc | 21 | ||||
-rw-r--r-- | content/renderer/media/midi_dispatcher.h | 12 | ||||
-rw-r--r-- | content/renderer/media/midi_message_filter.cc | 74 | ||||
-rw-r--r-- | content/renderer/media/midi_message_filter.h | 20 | ||||
-rw-r--r-- | content/renderer/media/renderer_webmidiaccessor_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/media/renderer_webmidiaccessor_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.h | 6 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 6 |
10 files changed, 76 insertions, 75 deletions
diff --git a/content/renderer/media/midi_dispatcher.cc b/content/renderer/media/midi_dispatcher.cc index 1f04e3e..a7c0679 100644 --- a/content/renderer/media/midi_dispatcher.cc +++ b/content/renderer/media/midi_dispatcher.cc @@ -16,32 +16,32 @@ using blink::WebSecurityOrigin; namespace content { -MIDIDispatcher::MIDIDispatcher(RenderViewImpl* render_view) +MidiDispatcher::MidiDispatcher(RenderViewImpl* render_view) : RenderViewObserver(render_view) { } -MIDIDispatcher::~MIDIDispatcher() {} +MidiDispatcher::~MidiDispatcher() {} -bool MIDIDispatcher::OnMessageReceived(const IPC::Message& message) { +bool MidiDispatcher::OnMessageReceived(const IPC::Message& message) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(MIDIDispatcher, message) - IPC_MESSAGE_HANDLER(MIDIMsg_SysExPermissionApproved, + IPC_BEGIN_MESSAGE_MAP(MidiDispatcher, message) + IPC_MESSAGE_HANDLER(MidiMsg_SysExPermissionApproved, OnSysExPermissionApproved) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } -void MIDIDispatcher::requestSysExPermission( +void MidiDispatcher::requestSysExPermission( const WebMIDIPermissionRequest& request) { int bridge_id = requests_.Add(new WebMIDIPermissionRequest(request)); WebSecurityOrigin security_origin = request.securityOrigin(); std::string origin = security_origin.toString().utf8(); GURL url(origin); - Send(new MIDIHostMsg_RequestSysExPermission(routing_id(), bridge_id, url)); + Send(new MidiHostMsg_RequestSysExPermission(routing_id(), bridge_id, url)); } -void MIDIDispatcher::cancelSysExPermissionRequest( +void MidiDispatcher::cancelSysExPermissionRequest( const WebMIDIPermissionRequest& request) { for (IDMap<WebMIDIPermissionRequest>::iterator it(&requests_); !it.IsAtEnd(); @@ -49,7 +49,7 @@ void MIDIDispatcher::cancelSysExPermissionRequest( WebMIDIPermissionRequest* value = it.GetCurrentValue(); if (value->equals(request)) { base::string16 origin = request.securityOrigin().toString(); - Send(new MIDIHostMsg_CancelSysExPermissionRequest( + Send(new MidiHostMsg_CancelSysExPermissionRequest( routing_id(), it.GetCurrentKey(), GURL(origin))); requests_.Remove(it.GetCurrentKey()); break; @@ -57,7 +57,8 @@ void MIDIDispatcher::cancelSysExPermissionRequest( } } -void MIDIDispatcher::OnSysExPermissionApproved(int bridge_id, bool is_allowed) { +void MidiDispatcher::OnSysExPermissionApproved(int bridge_id, + bool is_allowed) { // |request| can be NULL when the request is canceled. WebMIDIPermissionRequest* request = requests_.Lookup(bridge_id); if (!request) diff --git a/content/renderer/media/midi_dispatcher.h b/content/renderer/media/midi_dispatcher.h index 70f8125..8c875aa 100644 --- a/content/renderer/media/midi_dispatcher.h +++ b/content/renderer/media/midi_dispatcher.h @@ -17,16 +17,16 @@ namespace content { class RenderViewImpl; -// MIDIDispatcher implements WebMIDIClient to handle permissions for using +// MidiDispatcher implements WebMIDIClient to handle permissions for using // system exclusive messages. // It works as RenderViewObserver to handle IPC messages between -// MIDIDispatcherHost owned by RenderViewHost since permissions are managed in +// MidiDispatcherHost owned by RenderViewHost since permissions are managed in // the browser process. -class MIDIDispatcher : public RenderViewObserver, +class MidiDispatcher : public RenderViewObserver, public blink::WebMIDIClient { public: - explicit MIDIDispatcher(RenderViewImpl* render_view); - virtual ~MIDIDispatcher(); + explicit MidiDispatcher(RenderViewImpl* render_view); + virtual ~MidiDispatcher(); private: // RenderView::Observer implementation. @@ -46,7 +46,7 @@ class MIDIDispatcher : public RenderViewObserver, // WebMIDIPermissionRequest::setIsAllowed(). IDMap<blink::WebMIDIPermissionRequest> requests_; - DISALLOW_COPY_AND_ASSIGN(MIDIDispatcher); + DISALLOW_COPY_AND_ASSIGN(MidiDispatcher); }; } // namespace content diff --git a/content/renderer/media/midi_message_filter.cc b/content/renderer/media/midi_message_filter.cc index 992c46e..f349c6e 100644 --- a/content/renderer/media/midi_message_filter.cc +++ b/content/renderer/media/midi_message_filter.cc @@ -12,7 +12,7 @@ #include "content/renderer/render_thread_impl.h" #include "ipc/ipc_logging.h" -using media::MIDIPortInfoList; +using media::MidiPortInfoList; using base::AutoLock; // The maximum number of bytes which we're allowed to send to the browser @@ -22,7 +22,7 @@ static const size_t kMaxUnacknowledgedBytesSent = 10 * 1024 * 1024; // 10 MB. namespace content { -MIDIMessageFilter::MIDIMessageFilter( +MidiMessageFilter::MidiMessageFilter( const scoped_refptr<base::MessageLoopProxy>& io_message_loop) : channel_(NULL), io_message_loop_(io_message_loop), @@ -31,9 +31,9 @@ MIDIMessageFilter::MIDIMessageFilter( unacknowledged_bytes_sent_(0) { } -MIDIMessageFilter::~MIDIMessageFilter() {} +MidiMessageFilter::~MidiMessageFilter() {} -void MIDIMessageFilter::Send(IPC::Message* message) { +void MidiMessageFilter::Send(IPC::Message* message) { DCHECK(io_message_loop_->BelongsToCurrentThread()); if (!channel_) { delete message; @@ -42,24 +42,24 @@ void MIDIMessageFilter::Send(IPC::Message* message) { } } -bool MIDIMessageFilter::OnMessageReceived(const IPC::Message& message) { +bool MidiMessageFilter::OnMessageReceived(const IPC::Message& message) { DCHECK(io_message_loop_->BelongsToCurrentThread()); bool handled = true; - IPC_BEGIN_MESSAGE_MAP(MIDIMessageFilter, message) - IPC_MESSAGE_HANDLER(MIDIMsg_SessionStarted, OnSessionStarted) - IPC_MESSAGE_HANDLER(MIDIMsg_DataReceived, OnDataReceived) - IPC_MESSAGE_HANDLER(MIDIMsg_AcknowledgeSentData, OnAcknowledgeSentData) + IPC_BEGIN_MESSAGE_MAP(MidiMessageFilter, message) + IPC_MESSAGE_HANDLER(MidiMsg_SessionStarted, OnSessionStarted) + IPC_MESSAGE_HANDLER(MidiMsg_DataReceived, OnDataReceived) + IPC_MESSAGE_HANDLER(MidiMsg_AcknowledgeSentData, OnAcknowledgeSentData) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } -void MIDIMessageFilter::OnFilterAdded(IPC::Channel* channel) { +void MidiMessageFilter::OnFilterAdded(IPC::Channel* channel) { DCHECK(io_message_loop_->BelongsToCurrentThread()); channel_ = channel; } -void MIDIMessageFilter::OnFilterRemoved() { +void MidiMessageFilter::OnFilterRemoved() { DCHECK(io_message_loop_->BelongsToCurrentThread()); // Once removed, a filter will not be used again. At this time all @@ -67,12 +67,12 @@ void MIDIMessageFilter::OnFilterRemoved() { OnChannelClosing(); } -void MIDIMessageFilter::OnChannelClosing() { +void MidiMessageFilter::OnChannelClosing() { DCHECK(io_message_loop_->BelongsToCurrentThread()); channel_ = NULL; } -void MIDIMessageFilter::StartSession(blink::WebMIDIAccessorClient* client) { +void MidiMessageFilter::StartSession(blink::WebMIDIAccessorClient* client) { // Generate and keep track of a "client id" which is sent to the browser // to ask permission to talk to MIDI hardware. // This id is handed back when we receive the answer in OnAccessApproved(). @@ -81,16 +81,16 @@ void MIDIMessageFilter::StartSession(blink::WebMIDIAccessorClient* client) { clients_[client] = client_id; io_message_loop_->PostTask(FROM_HERE, - base::Bind(&MIDIMessageFilter::StartSessionOnIOThread, this, + base::Bind(&MidiMessageFilter::StartSessionOnIOThread, this, client_id)); } } -void MIDIMessageFilter::StartSessionOnIOThread(int client_id) { - Send(new MIDIHostMsg_StartSession(client_id)); +void MidiMessageFilter::StartSessionOnIOThread(int client_id) { + Send(new MidiHostMsg_StartSession(client_id)); } -void MIDIMessageFilter::RemoveClient(blink::WebMIDIAccessorClient* client) { +void MidiMessageFilter::RemoveClient(blink::WebMIDIAccessorClient* client) { ClientsMap::iterator i = clients_.find(client); if (i != clients_.end()) clients_.erase(i); @@ -98,23 +98,23 @@ void MIDIMessageFilter::RemoveClient(blink::WebMIDIAccessorClient* client) { // Received from browser. -void MIDIMessageFilter::OnSessionStarted( +void MidiMessageFilter::OnSessionStarted( int client_id, bool success, - MIDIPortInfoList inputs, - MIDIPortInfoList outputs) { + MidiPortInfoList inputs, + MidiPortInfoList outputs) { // Handle on the main JS thread. main_message_loop_->PostTask( FROM_HERE, - base::Bind(&MIDIMessageFilter::HandleSessionStarted, this, + base::Bind(&MidiMessageFilter::HandleSessionStarted, this, client_id, success, inputs, outputs)); } -void MIDIMessageFilter::HandleSessionStarted( +void MidiMessageFilter::HandleSessionStarted( int client_id, bool success, - MIDIPortInfoList inputs, - MIDIPortInfoList outputs) { + MidiPortInfoList inputs, + MidiPortInfoList outputs) { blink::WebMIDIAccessorClient* client = GetClientFromId(client_id); if (!client) return; @@ -141,7 +141,7 @@ void MIDIMessageFilter::HandleSessionStarted( } blink::WebMIDIAccessorClient* -MIDIMessageFilter::GetClientFromId(int client_id) { +MidiMessageFilter::GetClientFromId(int client_id) { // Iterating like this seems inefficient, but in practice there generally // will be very few clients (usually one). Additionally, this lookup // usually happens one time during page load. So the performance hit is @@ -153,57 +153,57 @@ MIDIMessageFilter::GetClientFromId(int client_id) { return NULL; } -void MIDIMessageFilter::OnDataReceived(uint32 port, +void MidiMessageFilter::OnDataReceived(uint32 port, const std::vector<uint8>& data, double timestamp) { - TRACE_EVENT0("midi", "MIDIMessageFilter::OnDataReceived"); + TRACE_EVENT0("midi", "MidiMessageFilter::OnDataReceived"); main_message_loop_->PostTask( FROM_HERE, - base::Bind(&MIDIMessageFilter::HandleDataReceived, this, + base::Bind(&MidiMessageFilter::HandleDataReceived, this, port, data, timestamp)); } -void MIDIMessageFilter::OnAcknowledgeSentData(size_t bytes_sent) { +void MidiMessageFilter::OnAcknowledgeSentData(size_t bytes_sent) { DCHECK_GE(unacknowledged_bytes_sent_, bytes_sent); if (unacknowledged_bytes_sent_ >= bytes_sent) unacknowledged_bytes_sent_ -= bytes_sent; } -void MIDIMessageFilter::HandleDataReceived(uint32 port, +void MidiMessageFilter::HandleDataReceived(uint32 port, const std::vector<uint8>& data, double timestamp) { DCHECK(!data.empty()); - TRACE_EVENT0("midi", "MIDIMessageFilter::HandleDataReceived"); + TRACE_EVENT0("midi", "MidiMessageFilter::HandleDataReceived"); for (ClientsMap::iterator i = clients_.begin(); i != clients_.end(); ++i) (*i).first->didReceiveMIDIData(port, &data[0], data.size(), timestamp); } -void MIDIMessageFilter::SendMIDIData(uint32 port, +void MidiMessageFilter::SendMidiData(uint32 port, const uint8* data, size_t length, double timestamp) { if (length > kMaxUnacknowledgedBytesSent) { - // TODO(crogers): buffer up the data to send at a later time. + // TODO(toyoshim): buffer up the data to send at a later time. // For now we're just dropping these bytes on the floor. return; } std::vector<uint8> v(data, data + length); io_message_loop_->PostTask(FROM_HERE, - base::Bind(&MIDIMessageFilter::SendMIDIDataOnIOThread, this, + base::Bind(&MidiMessageFilter::SendMidiDataOnIOThread, this, port, v, timestamp)); } -void MIDIMessageFilter::SendMIDIDataOnIOThread(uint32 port, +void MidiMessageFilter::SendMidiDataOnIOThread(uint32 port, const std::vector<uint8>& data, double timestamp) { size_t n = data.size(); if (n > kMaxUnacknowledgedBytesSent || unacknowledged_bytes_sent_ > kMaxUnacknowledgedBytesSent || n + unacknowledged_bytes_sent_ > kMaxUnacknowledgedBytesSent) { - // TODO(crogers): buffer up the data to send at a later time. + // TODO(toyoshim): buffer up the data to send at a later time. // For now we're just dropping these bytes on the floor. return; } @@ -211,7 +211,7 @@ void MIDIMessageFilter::SendMIDIDataOnIOThread(uint32 port, unacknowledged_bytes_sent_ += n; // Send to the browser. - Send(new MIDIHostMsg_SendData(port, data, timestamp)); + Send(new MidiHostMsg_SendData(port, data, timestamp)); } } // namespace content diff --git a/content/renderer/media/midi_message_filter.h b/content/renderer/media/midi_message_filter.h index c2e66ae..c7a4441 100644 --- a/content/renderer/media/midi_message_filter.h +++ b/content/renderer/media/midi_message_filter.h @@ -21,10 +21,10 @@ class MessageLoopProxy; namespace content { // MessageFilter that handles MIDI messages. -class CONTENT_EXPORT MIDIMessageFilter +class CONTENT_EXPORT MidiMessageFilter : public IPC::ChannelProxy::MessageFilter { public: - explicit MIDIMessageFilter( + explicit MidiMessageFilter( const scoped_refptr<base::MessageLoopProxy>& io_message_loop); // Each client registers for MIDI access here. @@ -36,7 +36,7 @@ class CONTENT_EXPORT MIDIMessageFilter // A client will only be able to call this method if it has a suitable // output port (from addOutputPort()). - void SendMIDIData(uint32 port, + void SendMidiData(uint32 port, const uint8* data, size_t length, double timestamp); @@ -47,7 +47,7 @@ class CONTENT_EXPORT MIDIMessageFilter } protected: - virtual ~MIDIMessageFilter(); + virtual ~MidiMessageFilter(); private: // Sends an IPC message using |channel_|. @@ -63,8 +63,8 @@ class CONTENT_EXPORT MIDIMessageFilter // MIDI hardware. void OnSessionStarted(int client_id, bool success, - media::MIDIPortInfoList inputs, - media::MIDIPortInfoList outputs); + media::MidiPortInfoList inputs, + media::MidiPortInfoList outputs); // Called when the browser process has sent MIDI data containing one or // more messages. @@ -79,8 +79,8 @@ class CONTENT_EXPORT MIDIMessageFilter void HandleSessionStarted(int client_id, bool success, - media::MIDIPortInfoList inputs, - media::MIDIPortInfoList outputs); + media::MidiPortInfoList inputs, + media::MidiPortInfoList outputs); void HandleDataReceived(uint32 port, const std::vector<uint8>& data, @@ -88,7 +88,7 @@ class CONTENT_EXPORT MIDIMessageFilter void StartSessionOnIOThread(int client_id); - void SendMIDIDataOnIOThread(uint32 port, + void SendMidiDataOnIOThread(uint32 port, const std::vector<uint8>& data, double timestamp); @@ -115,7 +115,7 @@ class CONTENT_EXPORT MIDIMessageFilter size_t unacknowledged_bytes_sent_; - DISALLOW_COPY_AND_ASSIGN(MIDIMessageFilter); + DISALLOW_COPY_AND_ASSIGN(MidiMessageFilter); }; } // namespace content diff --git a/content/renderer/media/renderer_webmidiaccessor_impl.cc b/content/renderer/media/renderer_webmidiaccessor_impl.cc index b121746..75b6b972 100644 --- a/content/renderer/media/renderer_webmidiaccessor_impl.cc +++ b/content/renderer/media/renderer_webmidiaccessor_impl.cc @@ -29,14 +29,14 @@ void RendererWebMIDIAccessorImpl::sendMIDIData( const unsigned char* data, size_t length, double timestamp) { - midi_message_filter()->SendMIDIData( + midi_message_filter()->SendMidiData( port_index, data, length, timestamp); } -MIDIMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() { +MidiMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() { return RenderThreadImpl::current()->midi_message_filter(); } diff --git a/content/renderer/media/renderer_webmidiaccessor_impl.h b/content/renderer/media/renderer_webmidiaccessor_impl.h index 4ebaffd..791c294 100644 --- a/content/renderer/media/renderer_webmidiaccessor_impl.h +++ b/content/renderer/media/renderer_webmidiaccessor_impl.h @@ -12,7 +12,7 @@ namespace content { -class MIDIMessageFilter; +class MidiMessageFilter; class RendererWebMIDIAccessorImpl : public blink::WebMIDIAccessor { @@ -31,7 +31,7 @@ class RendererWebMIDIAccessorImpl private: blink::WebMIDIAccessorClient* client_; - MIDIMessageFilter* midi_message_filter(); + MidiMessageFilter* midi_message_filter(); DISALLOW_COPY_AND_ASSIGN(RendererWebMIDIAccessorImpl); }; diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 8bcd62d..026b128 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -371,7 +371,7 @@ void RenderThreadImpl::Init() { audio_message_filter_ = new AudioMessageFilter(GetIOMessageLoopProxy()); AddFilter(audio_message_filter_.get()); - midi_message_filter_ = new MIDIMessageFilter(GetIOMessageLoopProxy()); + midi_message_filter_ = new MidiMessageFilter(GetIOMessageLoopProxy()); AddFilter(midi_message_filter_.get()); AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter()); diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index c05d775..08f1663 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -85,7 +85,7 @@ class InputEventFilter; class InputHandlerManager; class MediaStreamCenter; class MediaStreamDependencyFactory; -class MIDIMessageFilter; +class MidiMessageFilter; class P2PSocketDispatcher; class PeerConnectionTracker; class RendererDemuxerAndroid; @@ -214,7 +214,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread, return audio_message_filter_.get(); } - MIDIMessageFilter* midi_message_filter() { + MidiMessageFilter* midi_message_filter() { return midi_message_filter_.get(); } @@ -416,7 +416,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread, scoped_refptr<DBMessageFilter> db_message_filter_; scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_; scoped_refptr<AudioMessageFilter> audio_message_filter_; - scoped_refptr<MIDIMessageFilter> midi_message_filter_; + scoped_refptr<MidiMessageFilter> midi_message_filter_; #if defined(OS_ANDROID) scoped_refptr<RendererDemuxerAndroid> renderer_demuxer_; #endif diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 5d3a5cd..6b49253 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -5745,7 +5745,7 @@ blink::WebUserMediaClient* RenderViewImpl::userMediaClient() { blink::WebMIDIClient* RenderViewImpl::webMIDIClient() { if (!midi_dispatcher_) - midi_dispatcher_ = new MIDIDispatcher(this); + midi_dispatcher_ = new MidiDispatcher(this); return midi_dispatcher_; } diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index a95d468..7333424 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -147,7 +147,7 @@ class ImageResourceFetcher; class InputTagSpeechDispatcher; class JavaBridgeDispatcher; class LoadProgressTracker; -class MIDIDispatcher; +class MidiDispatcher; class MediaStreamClient; class MediaStreamDispatcher; class MouseLockDispatcher; @@ -1339,8 +1339,8 @@ class CONTENT_EXPORT RenderViewImpl MediaStreamClient* media_stream_client_; blink::WebUserMediaClient* web_user_media_client_; - // MIDIClient attached to this view; lazily initialized. - MIDIDispatcher* midi_dispatcher_; + // MidiClient attached to this view; lazily initialized. + MidiDispatcher* midi_dispatcher_; DevToolsAgent* devtools_agent_; |