OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 29 matching lines...) Expand all Loading... |
40 void* user_data); | 40 void* user_data); |
41 virtual ~Audio(); | 41 virtual ~Audio(); |
42 | 42 |
43 // Resource overrides. | 43 // Resource overrides. |
44 virtual PPB_Audio_API* AsPPB_Audio_API(); | 44 virtual PPB_Audio_API* AsPPB_Audio_API(); |
45 | 45 |
46 // PPB_Audio_API implementation. | 46 // PPB_Audio_API implementation. |
47 virtual PP_Resource GetCurrentConfig() OVERRIDE; | 47 virtual PP_Resource GetCurrentConfig() OVERRIDE; |
48 virtual PP_Bool StartPlayback() OVERRIDE; | 48 virtual PP_Bool StartPlayback() OVERRIDE; |
49 virtual PP_Bool StopPlayback() OVERRIDE; | 49 virtual PP_Bool StopPlayback() OVERRIDE; |
50 virtual int32_t OpenTrusted(PP_Resource config_id, | 50 virtual int32_t OpenTrusted( |
51 PP_CompletionCallback create_callback) OVERRIDE; | 51 PP_Resource config_id, |
| 52 scoped_refptr<TrackedCallback> create_callback) OVERRIDE; |
52 virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE; | 53 virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE; |
53 virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE; | 54 virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE; |
54 | 55 |
55 private: | 56 private: |
56 // Owning reference to the current config object. This isn't actually used, | 57 // Owning reference to the current config object. This isn't actually used, |
57 // we just dish it out as requested by the plugin. | 58 // we just dish it out as requested by the plugin. |
58 PP_Resource config_; | 59 PP_Resource config_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(Audio); | 61 DISALLOW_COPY_AND_ASSIGN(Audio); |
61 }; | 62 }; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (!playing()) | 99 if (!playing()) |
99 return PP_TRUE; | 100 return PP_TRUE; |
100 PluginDispatcher::GetForResource(this)->Send( | 101 PluginDispatcher::GetForResource(this)->Send( |
101 new PpapiHostMsg_PPBAudio_StartOrStop( | 102 new PpapiHostMsg_PPBAudio_StartOrStop( |
102 API_ID_PPB_AUDIO, host_resource(), false)); | 103 API_ID_PPB_AUDIO, host_resource(), false)); |
103 SetStopPlaybackState(); | 104 SetStopPlaybackState(); |
104 return PP_TRUE; | 105 return PP_TRUE; |
105 } | 106 } |
106 | 107 |
107 int32_t Audio::OpenTrusted(PP_Resource config_id, | 108 int32_t Audio::OpenTrusted(PP_Resource config_id, |
108 PP_CompletionCallback create_callback) { | 109 scoped_refptr<TrackedCallback> create_callback) { |
109 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. | 110 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. |
110 } | 111 } |
111 | 112 |
112 int32_t Audio::GetSyncSocket(int* sync_socket) { | 113 int32_t Audio::GetSyncSocket(int* sync_socket) { |
113 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. | 114 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. |
114 } | 115 } |
115 | 116 |
116 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) { | 117 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) { |
117 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. | 118 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. |
118 } | 119 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 base::SharedMemory temp_mem(handle, false); | 314 base::SharedMemory temp_mem(handle, false); |
314 } else { | 315 } else { |
315 static_cast<Audio*>(enter.object())->SetStreamInfo( | 316 static_cast<Audio*>(enter.object())->SetStreamInfo( |
316 enter.resource()->pp_instance(), handle, length, | 317 enter.resource()->pp_instance(), handle, length, |
317 IPC::PlatformFileForTransitToPlatformFile(socket_handle)); | 318 IPC::PlatformFileForTransitToPlatformFile(socket_handle)); |
318 } | 319 } |
319 } | 320 } |
320 | 321 |
321 } // namespace proxy | 322 } // namespace proxy |
322 } // namespace ppapi | 323 } // namespace ppapi |
OLD | NEW |