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

Unified Diff: ppapi/proxy/ppb_flash_menu_proxy.cc

Issue 7551032: Add a template to handle properly issuing completion callbacks. This fixes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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_file_system_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_flash_menu_proxy.cc
===================================================================
--- ppapi/proxy/ppb_flash_menu_proxy.cc (revision 94913)
+++ ppapi/proxy/ppb_flash_menu_proxy.cc (working copy)
@@ -162,22 +162,14 @@
const PP_Point& location) {
ShowRequest* request = new ShowRequest;
request->menu = menu;
- CompletionCallback callback = callback_factory_.NewOptionalCallback(
- &PPB_Flash_Menu_Proxy::SendShowACKToPlugin, request);
- EnterHostFromHostResource<PPB_Flash_Menu_API> enter(menu);
- int32_t result = PP_ERROR_BADRESOURCE;
+ EnterHostFromHostResourceForceCallback<PPB_Flash_Menu_API> enter(
+ menu, callback_factory_, &PPB_Flash_Menu_Proxy::SendShowACKToPlugin,
+ request);
if (enter.succeeded()) {
- result = enter.object()->Show(&location,
- &request->selected_id,
- callback.pp_completion_callback());
+ enter.SetResult(enter.object()->Show(&location, &request->selected_id,
+ enter.callback()));
}
- if (result != PP_OK_COMPLETIONPENDING) {
- // There was some error, so we won't get a callback. We need to now issue
- // the ACK to the plugin so that it hears about the error. This will also
- // clean up the data associated with the callback.
- callback.Run(result);
- }
}
void PPB_Flash_Menu_Proxy::OnMsgShowACK(const HostResource& menu,
« no previous file with comments | « ppapi/proxy/ppb_file_system_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698