Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: ppapi/shared_impl/ppb_audio_shared.cc

Issue 240523002: Add test to make sure if PPB_Audio_Shared::StartThread() works. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/ppb_audio_shared.h ('k') | ppapi/tests/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/ppb_audio_shared.cc
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc
index ced11466970c6e2ba26eb9d87fb3f1c94d49993b..c8c97d4096fb8fca4931670a0ad25f998b6051cf 100644
--- a/ppapi/shared_impl/ppb_audio_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -146,10 +146,10 @@ void PPB_Audio_Shared::StartThread() {
#else
// Use NaCl's special API for IRT code that creates threads that call back
// into user code.
- if (NULL == thread_functions.thread_create ||
- NULL == thread_functions.thread_join)
+ if (!IsThreadFunctionReady())
return;
+ DCHECK(!thread_active_);
int result = thread_functions.thread_create(&thread_id_, CallRun, this);
DCHECK_EQ(result, 0);
thread_active_ = true;
@@ -179,12 +179,20 @@ void PPB_Audio_Shared::StopThread() {
#endif
}
+// static
+bool PPB_Audio_Shared::IsThreadFunctionReady() {
+#if defined(OS_NACL)
+ if (thread_functions.thread_create == NULL ||
+ thread_functions.thread_join == NULL)
+ return false;
+#endif
+ return true;
+}
+
#if defined(OS_NACL)
// static
void PPB_Audio_Shared::SetThreadFunctions(
const struct PP_ThreadFunctions* functions) {
- DCHECK(thread_functions.thread_create == NULL);
- DCHECK(thread_functions.thread_join == NULL);
thread_functions = *functions;
}
« no previous file with comments | « ppapi/shared_impl/ppb_audio_shared.h ('k') | ppapi/tests/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698