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

Unified Diff: webkit/plugins/ppapi/audio_helper.cc

Issue 9015013: Convert callers to use the new TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
Index: webkit/plugins/ppapi/audio_helper.cc
diff --git a/webkit/plugins/ppapi/audio_helper.cc b/webkit/plugins/ppapi/audio_helper.cc
index a077e5b2f1cea4c2c63e033b1c914ecde79e62fc..5af7db3f819c88dea808bc857f173fbfc2196c7c 100644
--- a/webkit/plugins/ppapi/audio_helper.cc
+++ b/webkit/plugins/ppapi/audio_helper.cc
@@ -12,19 +12,10 @@ namespace ppapi {
// AudioHelper -----------------------------------------------------------------
-AudioHelper::AudioHelper()
- : create_callback_pending_(false),
- shared_memory_size_for_create_callback_(0) {
- create_callback_ = PP_MakeCompletionCallback(NULL, NULL);
+AudioHelper::AudioHelper() {
}
AudioHelper::~AudioHelper() {
- // If the completion callback hasn't fired yet, do so here
- // with an error condition.
- if (create_callback_pending_) {
- PP_RunCompletionCallback(&create_callback_, PP_ERROR_ABORTED);
- create_callback_pending_ = false;
- }
}
int32_t AudioHelper::GetSyncSocketImpl(int* sync_socket) {
@@ -61,7 +52,7 @@ void AudioHelper::StreamCreated(
base::SharedMemoryHandle shared_memory_handle,
size_t shared_memory_size,
base::SyncSocket::Handle socket_handle) {
- if (create_callback_pending_) {
+ if (create_callback_.get()) {
// Trusted side of proxy can specify a callback to recieve handles. In
// this case we don't need to map any data or start the thread since it
// will be handled by the proxy.
@@ -70,8 +61,7 @@ void AudioHelper::StreamCreated(
shared_memory_size_for_create_callback_ = shared_memory_size;
socket_for_create_callback_.reset(new base::SyncSocket(socket_handle));
- PP_RunCompletionCallback(&create_callback_, 0);
- create_callback_pending_ = false;
+ ::ppapi::TrackedCallback::ClearAndRun(&create_callback_, PP_OK);
// It might be nice to close the handles here to free up some system
// resources, but we can't since there's a race condition. The handles must
@@ -85,9 +75,9 @@ void AudioHelper::StreamCreated(
}
}
-void AudioHelper::SetCallbackInfo(bool create_callback_pending,
- PP_CompletionCallback create_callback) {
- create_callback_pending_ = create_callback_pending;
+void AudioHelper::SetCreateCallback(
+ scoped_refptr< ::ppapi::TrackedCallback> create_callback) {
+ DCHECK(!create_callback_.get());
create_callback_ = create_callback;
}

Powered by Google App Engine
This is Rietveld 408576698