diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 20:52:20 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 20:52:20 +0000 |
commit | 0609474310417da4a2235d85639aa387a8df0a6b (patch) | |
tree | 15f7ce49d32bfd832e65d6f015db5ae70607c6a9 /ppapi/proxy/ppb_url_loader_proxy.cc | |
parent | 7efc582d60227aa473c77c3309a96b2dfed52351 (diff) | |
download | chromium_src-0609474310417da4a2235d85639aa387a8df0a6b.zip chromium_src-0609474310417da4a2235d85639aa387a8df0a6b.tar.gz chromium_src-0609474310417da4a2235d85639aa387a8df0a6b.tar.bz2 |
Add a template to handle properly issuing completion callbacks. This fixes
some bugs where we forgot to issue completion callbacks in some error cases
in the proxy, and cleans up the cases that were already doing this properly.
This removes the PPB_AudioTrusted_API and folds those functions into the
regular Audio API. I'm trying to merge more things to have a smaller explosion
of APIs and the boilerplate associated with them.
Review URL: http://codereview.chromium.org/7551032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_url_loader_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_url_loader_proxy.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index b2d6276..1fc4db1 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -517,21 +517,12 @@ void PPB_URLLoader_Proxy::OnMsgReadResponseBody( // 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()); - } - 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); + bytes_to_read, enter.callback())); } } |