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

Unified Diff: webkit/plugins/ppapi/ppb_url_loader_impl.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 | « webkit/plugins/ppapi/ppb_url_loader_impl.h ('k') | webkit/plugins/ppapi/ppb_video_capture_impl.h » ('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 7e4fdef0f443ab797c7ccdbeb2b64b46ac2c6284..efb36cc7d27d4a57397c1d8a0ecd17166b0927da 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
@@ -96,7 +96,7 @@ void PPB_URLLoader_Impl::InstanceWasDeleted() {
}
int32_t PPB_URLLoader_Impl::Open(PP_Resource request_id,
- PP_CompletionCallback callback) {
+ scoped_refptr<TrackedCallback> callback) {
// Main document loads are already open, so don't allow people to open them
// again.
if (main_document_loader_)
@@ -172,7 +172,8 @@ int32_t PPB_URLLoader_Impl::Open(PP_Resource request_id,
return PP_OK_COMPLETIONPENDING;
}
-int32_t PPB_URLLoader_Impl::FollowRedirect(PP_CompletionCallback callback) {
+int32_t PPB_URLLoader_Impl::FollowRedirect(
+ scoped_refptr<TrackedCallback> callback) {
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
@@ -215,9 +216,10 @@ PP_Resource PPB_URLLoader_Impl::GetResponseInfo() {
return response_info_->GetReference();
}
-int32_t PPB_URLLoader_Impl::ReadResponseBody(void* buffer,
- int32_t bytes_to_read,
- PP_CompletionCallback callback) {
+int32_t PPB_URLLoader_Impl::ReadResponseBody(
+ void* buffer,
+ int32_t bytes_to_read,
+ scoped_refptr<TrackedCallback> callback) {
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
@@ -244,7 +246,7 @@ int32_t PPB_URLLoader_Impl::ReadResponseBody(void* buffer,
}
int32_t PPB_URLLoader_Impl::FinishStreamingToFile(
- PP_CompletionCallback callback) {
+ scoped_refptr<TrackedCallback> callback) {
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
@@ -395,10 +397,9 @@ void PPB_URLLoader_Impl::FinishLoading(int32_t done_status) {
RunCallback(done_status_);
}
-int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) {
- // We only support non-blocking calls.
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
+int32_t PPB_URLLoader_Impl::ValidateCallback(
+ scoped_refptr<TrackedCallback> callback) {
+ DCHECK(callback);
if (TrackedCallback::IsPending(pending_callback_))
return PP_ERROR_INPROGRESS;
@@ -406,15 +407,15 @@ int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) {
return PP_OK;
}
-void PPB_URLLoader_Impl::RegisterCallback(PP_CompletionCallback callback) {
- DCHECK(callback.func);
+void PPB_URLLoader_Impl::RegisterCallback(
+ scoped_refptr<TrackedCallback> callback) {
DCHECK(!TrackedCallback::IsPending(pending_callback_));
PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
if (!plugin_module)
return;
- pending_callback_ = new TrackedCallback(this, callback);
+ pending_callback_ = callback;
}
void PPB_URLLoader_Impl::RunCallback(int32_t result) {
« no previous file with comments | « webkit/plugins/ppapi/ppb_url_loader_impl.h ('k') | webkit/plugins/ppapi/ppb_video_capture_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698