diff options
Diffstat (limited to 'chromium/ppapi/shared_impl/ppb_audio_shared.h')
-rw-r--r-- | chromium/ppapi/shared_impl/ppb_audio_shared.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/chromium/ppapi/shared_impl/ppb_audio_shared.h b/chromium/ppapi/shared_impl/ppb_audio_shared.h index 738c56b083e..31888c88264 100644 --- a/chromium/ppapi/shared_impl/ppb_audio_shared.h +++ b/chromium/ppapi/shared_impl/ppb_audio_shared.h @@ -15,9 +15,7 @@ #include "ppapi/shared_impl/resource.h" #include "ppapi/thunk/ppb_audio_api.h" -#if defined(OS_NACL) -#include "native_client/src/untrusted/irt/irt_ppapi.h" -#endif +struct PP_ThreadFunctions; namespace ppapi { @@ -79,11 +77,20 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared PP_AudioSampleRate sample_rate, int sample_frame_count); -#if defined(OS_NACL) + // Returns whether a thread can be created on the client context. + // In trusted plugin, this should always return true, as it uses Chrome's + // thread library. In NaCl plugin, this returns whether SetThreadFunctions + // was invoked properly. + static bool IsThreadFunctionReady(); + + // Configures this class to run in a NaCl plugin. + // If called, SetThreadFunctions() must be called before calling + // SetStartPlaybackState() on any instance of this class. + static void SetNaClMode(); + // NaCl has a special API for IRT code to create threads that can call back // into user code. static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); -#endif private: // Starts execution of the audio thread. @@ -110,15 +117,12 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared // The size of the sample buffer in bytes. size_t shared_memory_size_; -#if !defined(OS_NACL) // When the callback is set, this thread is spawned for calling it. scoped_ptr<base::DelegateSimpleThread> audio_thread_; -#else - uintptr_t thread_id_; - bool thread_active_; + uintptr_t nacl_thread_id_; + bool nacl_thread_active_; static void CallRun(void* self); -#endif // Callback to call when audio is ready to accept new samples. AudioCallbackCombined callback_; |