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

Unified Diff: ppapi/proxy/ppb_url_loader_proxy.cc

Issue 7585025: Reland 95309. Add a template to handle properly issuing completion callbacks. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « ppapi/proxy/ppb_surface_3d_proxy.cc ('k') | ppapi/thunk/ppb_audio_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_url_loader_proxy.cc
===================================================================
--- ppapi/proxy/ppb_url_loader_proxy.cc (revision 95737)
+++ ppapi/proxy/ppb_url_loader_proxy.cc (working copy)
@@ -517,22 +517,13 @@
// TODO(brettw) have a way to check for out-of-memory.
info->read_buffer.resize(bytes_to_read);
- CompletionCallback callback = callback_factory_.NewOptionalCallback(
- &PPB_URLLoader_Proxy::OnReadCallback, info);
-
- EnterHostFromHostResource<PPB_URLLoader_API> enter(loader);
- int32_t result = PP_ERROR_BADRESOURCE;
+ EnterHostFromHostResourceForceCallback<PPB_URLLoader_API> enter(
+ loader, callback_factory_, &PPB_URLLoader_Proxy::OnReadCallback, info);
if (enter.succeeded()) {
- result = enter.object()->ReadResponseBody(
+ enter.SetResult(enter.object()->ReadResponseBody(
const_cast<char*>(info->read_buffer.c_str()),
- bytes_to_read, callback.pp_completion_callback());
+ bytes_to_read, enter.callback()));
}
- if (result != PP_OK_COMPLETIONPENDING) {
- // Send error (or perhaps success for synchronous reads) back to plugin.
- // The callback function is already set up to do this and also delete the
- // callback info.
- callback.Run(result);
- }
}
void PPB_URLLoader_Proxy::OnMsgFinishStreamingToFile(
« no previous file with comments | « ppapi/proxy/ppb_surface_3d_proxy.cc ('k') | ppapi/thunk/ppb_audio_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698