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_file_chooser_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_file_chooser_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_file_chooser_proxy.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc index cda175f..d8ea705 100644 --- a/ppapi/proxy/ppb_file_chooser_proxy.cc +++ b/ppapi/proxy/ppb_file_chooser_proxy.cc @@ -194,13 +194,11 @@ void PPB_FileChooser_Proxy::OnMsgCreate(PP_Instance instance, } void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) { - CompletionCallback callback = callback_factory_.NewOptionalCallback( - &PPB_FileChooser_Proxy::OnShowCallback, chooser); - - int32_t result = ppb_file_chooser_target()->Show( - chooser.host_resource(), callback.pp_completion_callback()); - if (result != PP_OK_COMPLETIONPENDING) - callback.Run(result); + EnterHostFromHostResourceForceCallback<PPB_FileChooser_API> enter( + chooser, callback_factory_, &PPB_FileChooser_Proxy::OnShowCallback, + chooser); + if (enter.succeeded()) + enter.SetResult(enter.object()->Show(enter.callback())); } void PPB_FileChooser_Proxy::OnMsgChooseComplete( |