#ifndef CONTENT_RENDERER_PEPPER_AUDIO_HELPER_H_
#define CONTENT_RENDERER_PEPPER_AUDIO_HELPER_H_
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/tracked_callback.h"
namespace content {
class AudioHelper {
public:
AudioHelper();
virtual ~AudioHelper();
void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
size_t shared_memory_size_,
base::SyncSocket::Handle socket);
void SetCreateCallback(
scoped_refptr<ppapi::TrackedCallback> create_callback);
protected:
int32_t GetSyncSocketImpl(int* sync_socket);
int32_t GetSharedMemoryImpl(int* shm_handle, uint32_t* shm_size);
virtual void OnSetStreamInfo(base::SharedMemoryHandle shared_memory_handle,
size_t shared_memory_size,
base::SyncSocket::Handle socket_handle) = 0;
private:
scoped_refptr<ppapi::TrackedCallback> create_callback_;
scoped_ptr<base::SharedMemory> shared_memory_for_create_callback_;
size_t shared_memory_size_for_create_callback_;
scoped_ptr<base::SyncSocket> socket_for_create_callback_;
DISALLOW_COPY_AND_ASSIGN(AudioHelper);
};
}
#endif