OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/shared_memory.h" |
| 11 #include "base/sync_socket.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/shared_impl/resource.h" |
| 14 #include "ppapi/shared_impl/scoped_pp_resource.h" |
| 15 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 17 |
| 18 namespace webkit { |
| 19 namespace ppapi { |
| 20 |
| 21 class AudioHelper { |
| 22 public: |
| 23 AudioHelper(); |
| 24 virtual ~AudioHelper(); |
| 25 |
| 26 virtual int32_t GetSyncSocket(int* sync_socket); |
| 27 virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size); |
| 28 |
| 29 virtual void OnSetStreamInfo(base::SharedMemoryHandle shared_memory_handle, |
| 30 size_t shared_memory_size, |
| 31 base::SyncSocket::Handle socket_handle) = 0; |
| 32 |
| 33 void StreamCreated_(base::SharedMemoryHandle shared_memory_handle, |
| 34 size_t shared_memory_size_, |
| 35 base::SyncSocket::Handle socket); |
| 36 |
| 37 void SetCallbackInfo(bool create_callback_pending, |
| 38 PP_CompletionCallback create_callback); |
| 39 |
| 40 private: |
| 41 // Is a create callback pending to fire? |
| 42 bool create_callback_pending_; |
| 43 |
| 44 // Trusted callback invoked from StreamCreated. |
| 45 PP_CompletionCallback create_callback_; |
| 46 |
| 47 // When a create callback is being issued, these will save the info for |
| 48 // querying from the callback. The proxy uses this to get the handles to the |
| 49 // other process instead of mapping them in the renderer. These will be |
| 50 // invalid all other times. |
| 51 scoped_ptr<base::SharedMemory> shared_memory_for_create_callback_; |
| 52 size_t shared_memory_size_for_create_callback_; |
| 53 scoped_ptr<base::SyncSocket> socket_for_create_callback_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(AudioHelper); |
| 56 }; |
| 57 |
| 58 } // namespace ppapi |
| 59 } // namespace webkit |
| 60 |
| 61 #endif // WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ |
| 62 |
OLD | NEW |