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

Unified Diff: webkit/plugins/ppapi/ppb_url_loader_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_url_loader_impl.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_url_loader_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
index d989fcd3569effd01a4cb7e82ecba7567a3155ad..9b96b8aeaf5af724728c801268d032f7410af2c2 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
@@ -36,6 +36,7 @@ using ppapi::Resource;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_URLLoader_API;
using ppapi::thunk::PPB_URLRequestInfo_API;
+using ppapi::TrackedCallback;
using WebKit::WebFrame;
using WebKit::WebString;
using WebKit::WebURL;
@@ -317,7 +318,7 @@ void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader,
if (user_buffer_) {
RunCallback(FillUserBuffer());
} else {
- DCHECK(!pending_callback_.get() || pending_callback_->completed());
+ DCHECK(!TrackedCallback::IsPending(pending_callback_));
}
// To avoid letting the network stack download an entire stream all at once,
@@ -374,7 +375,7 @@ void PPB_URLLoader_Impl::FinishLoading(int32_t done_status) {
// If the client hasn't called any function that takes a callback since
// the initial call to Open, or called ReadResponseBody and got a
// synchronous return, then the callback will be NULL.
- if (pending_callback_.get() && !pending_callback_->completed())
+ if (TrackedCallback::IsPending(pending_callback_))
RunCallback(done_status_);
}
@@ -383,7 +384,7 @@ int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) {
if (!callback.func)
return PP_ERROR_BLOCKS_MAIN_THREAD;
- if (pending_callback_.get() && !pending_callback_->completed())
+ if (TrackedCallback::IsPending(pending_callback_))
return PP_ERROR_INPROGRESS;
return PP_OK;
@@ -391,14 +392,13 @@ int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) {
void PPB_URLLoader_Impl::RegisterCallback(PP_CompletionCallback callback) {
DCHECK(callback.func);
- DCHECK(!pending_callback_.get() || pending_callback_->completed());
+ DCHECK(!TrackedCallback::IsPending(pending_callback_));
PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
if (!plugin_module)
return;
- pending_callback_ = new TrackedCompletionCallback(
- plugin_module->GetCallbackTracker(), pp_resource(), callback);
+ pending_callback_ = new TrackedCallback(this, callback);
}
void PPB_URLLoader_Impl::RunCallback(int32_t result) {
@@ -407,10 +407,7 @@ void PPB_URLLoader_Impl::RunCallback(int32_t result) {
CHECK(main_document_loader_);
return;
}
-
- scoped_refptr<TrackedCompletionCallback> callback;
- callback.swap(pending_callback_);
- callback->Run(result); // Will complete abortively if necessary.
+ TrackedCallback::ClearAndRun(&pending_callback_, result);
}
size_t PPB_URLLoader_Impl::FillUserBuffer() {
« no previous file with comments | « webkit/plugins/ppapi/ppb_url_loader_impl.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698