| 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 "ppapi/proxy/ppb_audio_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_proxy.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/threading/simple_thread.h" | 8 #include "base/threading/simple_thread.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_audio.h" | 10 #include "ppapi/c/ppb_audio.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return 0; | 171 return 0; |
| 172 | 172 |
| 173 HostResource result; | 173 HostResource result; |
| 174 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create( | 174 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create( |
| 175 INTERFACE_ID_PPB_AUDIO, instance_id, | 175 INTERFACE_ID_PPB_AUDIO, instance_id, |
| 176 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), | 176 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), |
| 177 &result)); | 177 &result)); |
| 178 if (result.is_null()) | 178 if (result.is_null()) |
| 179 return 0; | 179 return 0; |
| 180 | 180 |
| 181 linked_ptr<Audio> object(new Audio(result, config_id, | 181 return PluginResourceTracker::GetInstance()->AddResource( |
| 182 audio_callback, user_data)); | 182 new Audio(result, config_id, audio_callback, user_data)); |
| 183 return PluginResourceTracker::GetInstance()->AddResource(object); | |
| 184 } | 183 } |
| 185 | 184 |
| 186 bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { | 185 bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 187 bool handled = true; | 186 bool handled = true; |
| 188 IPC_BEGIN_MESSAGE_MAP(PPB_Audio_Proxy, msg) | 187 IPC_BEGIN_MESSAGE_MAP(PPB_Audio_Proxy, msg) |
| 189 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_Create, OnMsgCreate) | 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_Create, OnMsgCreate) |
| 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, | 189 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, |
| 191 OnMsgStartOrStop) | 190 OnMsgStartOrStop) |
| 192 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, | 191 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, |
| 193 OnMsgNotifyAudioStreamCreated) | 192 OnMsgNotifyAudioStreamCreated) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( | 334 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( |
| 336 IntToPlatformFile(shared_memory_handle), false); | 335 IntToPlatformFile(shared_memory_handle), false); |
| 337 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) | 336 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) |
| 338 return PP_ERROR_FAILED; | 337 return PP_ERROR_FAILED; |
| 339 | 338 |
| 340 return PP_OK; | 339 return PP_OK; |
| 341 } | 340 } |
| 342 | 341 |
| 343 } // namespace proxy | 342 } // namespace proxy |
| 344 } // namespace pp | 343 } // namespace pp |
| OLD | NEW |