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

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

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add IsPending Created 8 years, 12 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/ppb_broker_impl.h ('k') | webkit/plugins/ppapi/ppb_directory_reader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_broker_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_broker_impl.cc b/webkit/plugins/ppapi/ppb_broker_impl.cc
index 9696899ccd89d69daeae22731b0377945cc854c2..42273a14b4d03f8571dc9a0aa24180e7fb300376 100644
--- a/webkit/plugins/ppapi/ppb_broker_impl.cc
+++ b/webkit/plugins/ppapi/ppb_broker_impl.cc
@@ -10,8 +10,9 @@
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/resource_helper.h"
-using ::ppapi::PlatformFileToInt;
-using ::ppapi::thunk::PPB_Broker_API;
+using ppapi::PlatformFileToInt;
+using ppapi::thunk::PPB_Broker_API;
+using ppapi::TrackedCallback;
namespace webkit {
namespace ppapi {
@@ -60,15 +61,11 @@ int32_t PPB_Broker_Impl::Connect(PP_CompletionCallback connect_callback) {
// and BrokerConnected is called before ConnectToPpapiBroker returns.
// Because it must be created now, it must be aborted and cleared if
// ConnectToPpapiBroker fails.
- connect_callback_ = new TrackedCompletionCallback(
- plugin_instance->module()->GetCallbackTracker(), pp_resource(),
- connect_callback);
+ connect_callback_ = new TrackedCallback(this, connect_callback);
broker_ = plugin_instance->delegate()->ConnectToPpapiBroker(this);
if (!broker_) {
- scoped_refptr<TrackedCompletionCallback> callback;
- callback.swap(connect_callback_);
- callback->Abort();
+ TrackedCallback::ClearAndAbort(&connect_callback_);
return PP_ERROR_FAILED;
}
@@ -92,11 +89,9 @@ void PPB_Broker_Impl::BrokerConnected(int32_t handle, int32_t result) {
pipe_handle_ = handle;
// Synchronous calls are not supported.
- DCHECK(connect_callback_.get() && !connect_callback_->completed());
+ DCHECK(TrackedCallback::IsPending(connect_callback_));
- scoped_refptr<TrackedCompletionCallback> callback;
- callback.swap(connect_callback_);
- callback->Run(result); // Will complete abortively if necessary.
+ TrackedCallback::ClearAndRun(&connect_callback_, result);
}
} // namespace ppapi
« no previous file with comments | « webkit/plugins/ppapi/ppb_broker_impl.h ('k') | webkit/plugins/ppapi/ppb_directory_reader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698