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

Unified Diff: ppapi/shared_impl/ppb_audio_input_shared.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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_input_shared.h ('k') | ppapi/shared_impl/ppb_file_io_shared.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/ppb_audio_input_shared.cc
diff --git a/ppapi/shared_impl/ppb_audio_input_shared.cc b/ppapi/shared_impl/ppb_audio_input_shared.cc
index ea2e685beae029abc0a50c5caa231c27b4d877c7..4ea3e71f0ed1352090a079472dd0727d1293a38f 100644
--- a/ppapi/shared_impl/ppb_audio_input_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_input_shared.cc
@@ -55,9 +55,7 @@ thunk::PPB_AudioInput_API* PPB_AudioInput_Shared::AsPPB_AudioInput_API() {
int32_t PPB_AudioInput_Shared::EnumerateDevices(
PP_Resource* devices,
- const PP_CompletionCallback& callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
+ scoped_refptr<TrackedCallback> callback) {
if (TrackedCallback::IsPending(enumerate_devices_callback_))
return PP_ERROR_INPROGRESS;
@@ -69,7 +67,7 @@ int32_t PPB_AudioInput_Shared::Open(
PP_Resource config,
PPB_AudioInput_Callback audio_input_callback,
void* user_data,
- const PP_CompletionCallback& callback) {
+ scoped_refptr<TrackedCallback> callback) {
if (!audio_input_callback)
return PP_ERROR_BADARGUMENT;
@@ -166,8 +164,11 @@ void PPB_AudioInput_Shared::OnOpenComplete(
}
// static
-PP_CompletionCallback PPB_AudioInput_Shared::MakeIgnoredCompletionCallback() {
- return PP_MakeCompletionCallback(&IgnoredCompletionCallback, NULL);
+scoped_refptr<TrackedCallback>
+PPB_AudioInput_Shared::MakeIgnoredCompletionCallback(
+ Resource* resource) {
+ return new TrackedCallback(resource,
+ PP_MakeCompletionCallback(&IgnoredCompletionCallback, NULL));
}
void PPB_AudioInput_Shared::SetStartCaptureState() {
@@ -254,7 +255,7 @@ int32_t PPB_AudioInput_Shared::CommonOpen(
PP_Resource config,
PPB_AudioInput_Callback audio_input_callback,
void* user_data,
- PP_CompletionCallback callback) {
+ scoped_refptr<TrackedCallback> callback) {
if (open_state_ != BEFORE_OPEN)
return PP_ERROR_FAILED;
@@ -263,9 +264,6 @@ int32_t PPB_AudioInput_Shared::CommonOpen(
if (enter_config.failed())
return PP_ERROR_BADARGUMENT;
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
if (TrackedCallback::IsPending(open_callback_))
return PP_ERROR_INPROGRESS;
« no previous file with comments | « ppapi/shared_impl/ppb_audio_input_shared.h ('k') | ppapi/shared_impl/ppb_file_io_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698