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

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: Foo Created 8 years, 11 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 | « webkit/plugins/ppapi/audio_helper.h ('k') | webkit/plugins/ppapi/ppb_audio_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4a04f82d179b4b245c7710fba8e551012353b48b 100644
--- a/webkit/plugins/ppapi/audio_helper.cc
+++ b/webkit/plugins/ppapi/audio_helper.cc
@@ -7,24 +7,17 @@
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/resource_helper.h"
+using ppapi::TrackedCallback;
+
namespace webkit {
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 +54,7 @@ void AudioHelper::StreamCreated(
base::SharedMemoryHandle shared_memory_handle,
size_t shared_memory_size,
base::SyncSocket::Handle socket_handle) {
- if (create_callback_pending_) {
+ if (TrackedCallback::IsPending(create_callback_)) {
// 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 +63,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 +77,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(!TrackedCallback::IsPending(create_callback_));
create_callback_ = create_callback;
}
« no previous file with comments | « webkit/plugins/ppapi/audio_helper.h ('k') | webkit/plugins/ppapi/ppb_audio_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698