X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fppapi%2Fshared_impl%2Fppb_audio_shared.h;h=31888c882645fded45167c6de33fe941f97506d9;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=b503c534649cd1ee886dba922fdc68b54d600065;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/ppapi/shared_impl/ppb_audio_shared.h b/src/ppapi/shared_impl/ppb_audio_shared.h index b503c53..31888c8 100644 --- a/src/ppapi/shared_impl/ppb_audio_shared.h +++ b/src/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 "ppapi/nacl_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 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_;