| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/renderer/media/audio_message_filter.h" | 5 #include "content/renderer/media/audio_message_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (!channel_) { | 24 if (!channel_) { |
| 25 delete message; | 25 delete message; |
| 26 return false; | 26 return false; |
| 27 } | 27 } |
| 28 | 28 |
| 29 if (MessageLoop::current() != ChildProcess::current()->io_message_loop()) { | 29 if (MessageLoop::current() != ChildProcess::current()->io_message_loop()) { |
| 30 // Can only access the IPC::Channel on the IPC thread since it's not thread | 30 // Can only access the IPC::Channel on the IPC thread since it's not thread |
| 31 // safe. | 31 // safe. |
| 32 ChildProcess::current()->io_message_loop()->PostTask( | 32 ChildProcess::current()->io_message_loop()->PostTask( |
| 33 FROM_HERE, | 33 FROM_HERE, |
| 34 base::IgnoreReturn<bool>(base::Bind(&AudioMessageFilter::Send, | 34 base::Bind(base::IgnoreResult(&AudioMessageFilter::Send), this, |
| 35 this, message))); | 35 message)); |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 return channel_->Send(message); | 39 return channel_->Send(message); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool AudioMessageFilter::OnMessageReceived(const IPC::Message& message) { | 42 bool AudioMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| 43 bool handled = true; | 43 bool handled = true; |
| 44 IPC_BEGIN_MESSAGE_MAP(AudioMessageFilter, message) | 44 IPC_BEGIN_MESSAGE_MAP(AudioMessageFilter, message) |
| 45 IPC_MESSAGE_HANDLER(AudioMsg_RequestPacket, OnRequestPacket) | 45 IPC_MESSAGE_HANDLER(AudioMsg_RequestPacket, OnRequestPacket) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 delegate->OnVolume(volume); | 135 delegate->OnVolume(volume); |
| 136 } | 136 } |
| 137 | 137 |
| 138 int32 AudioMessageFilter::AddDelegate(Delegate* delegate) { | 138 int32 AudioMessageFilter::AddDelegate(Delegate* delegate) { |
| 139 return delegates_.Add(delegate); | 139 return delegates_.Add(delegate); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void AudioMessageFilter::RemoveDelegate(int32 id) { | 142 void AudioMessageFilter::RemoveDelegate(int32 id) { |
| 143 delegates_.Remove(id); | 143 delegates_.Remove(id); |
| 144 } | 144 } |
| OLD | NEW |