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

Unified Diff: ppapi/proxy/ppb_file_chooser_proxy.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 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
Index: ppapi/proxy/ppb_file_chooser_proxy.cc
diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc
index 466d0e698126ca991bda8add0c6ee5a38b228577..664592428843ac0756407bfa3b52d9095c3cfb4c 100644
--- a/ppapi/proxy/ppb_file_chooser_proxy.cc
+++ b/ppapi/proxy/ppb_file_chooser_proxy.cc
@@ -46,18 +46,16 @@ class FileChooser : public Resource,
// PPB_FileChooser_API implementation.
virtual int32_t Show(const PP_ArrayOutput& output,
- const PP_CompletionCallback& callback) OVERRIDE;
- virtual int32_t ShowWithoutUserGesture(
- PP_Bool save_as,
- PP_Var suggested_file_name,
- const PP_ArrayOutput& output,
- const PP_CompletionCallback& callback);
- virtual int32_t Show0_5(const PP_CompletionCallback& callback) OVERRIDE;
+ ApiCallbackType callback) OVERRIDE;
+ virtual int32_t ShowWithoutUserGesture(PP_Bool save_as,
+ PP_Var suggested_file_name,
+ const PP_ArrayOutput& output,
+ ApiCallbackType callback);
+ virtual int32_t Show0_5(ApiCallbackType callback) OVERRIDE;
virtual PP_Resource GetNextChosenFile() OVERRIDE;
- virtual int32_t ShowWithoutUserGesture0_5(
- PP_Bool save_as,
- PP_Var suggested_file_name,
- const PP_CompletionCallback& callback) OVERRIDE;
+ virtual int32_t ShowWithoutUserGesture0_5(PP_Bool save_as,
+ PP_Var suggested_file_name,
+ ApiCallbackType callback) OVERRIDE;
// Handles the choose complete notification from the host.
void ChooseComplete(
@@ -68,7 +66,7 @@ class FileChooser : public Resource,
int32_t Show(bool require_user_gesture,
PP_Bool save_as,
PP_Var suggested_file_name,
- const PP_CompletionCallback& callback);
+ ApiCallbackType callback);
// When using v0.6 of the API, contains the array output info.
ArrayWriter output_;
@@ -103,46 +101,41 @@ PPB_FileChooser_API* FileChooser::AsPPB_FileChooser_API() {
}
int32_t FileChooser::Show(const PP_ArrayOutput& output,
- const PP_CompletionCallback& callback) {
+ ApiCallbackType callback) {
int32_t result = Show(true, PP_FALSE, PP_MakeUndefined(), callback);
if (result == PP_OK_COMPLETIONPENDING)
output_.set_pp_array_output(output);
return result;
}
-int32_t FileChooser::ShowWithoutUserGesture(
- PP_Bool save_as,
- PP_Var suggested_file_name,
- const PP_ArrayOutput& output,
- const PP_CompletionCallback& callback) {
+int32_t FileChooser::ShowWithoutUserGesture(PP_Bool save_as,
+ PP_Var suggested_file_name,
+ const PP_ArrayOutput& output,
+ ApiCallbackType callback) {
int32_t result = Show(false, save_as, PP_MakeUndefined(), callback);
if (result == PP_OK_COMPLETIONPENDING)
output_.set_pp_array_output(output);
return result;
}
-int32_t FileChooser::Show0_5(const PP_CompletionCallback& callback) {
+int32_t FileChooser::Show0_5(ApiCallbackType callback) {
return Show(true, PP_FALSE, PP_MakeUndefined(), callback);
}
-int32_t FileChooser::ShowWithoutUserGesture0_5(
- PP_Bool save_as,
- PP_Var suggested_file_name,
- const PP_CompletionCallback& callback) {
+int32_t FileChooser::ShowWithoutUserGesture0_5(PP_Bool save_as,
+ PP_Var suggested_file_name,
+ ApiCallbackType callback) {
return Show(false, save_as, suggested_file_name, callback);
}
int32_t FileChooser::Show(bool require_user_gesture,
PP_Bool save_as,
PP_Var suggested_file_name,
- const PP_CompletionCallback& callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
+ ApiCallbackType callback) {
if (TrackedCallback::IsPending(current_show_callback_))
return PP_ERROR_INPROGRESS; // Can't show more than once.
- current_show_callback_ = new TrackedCallback(this, callback);
+ current_show_callback_ = callback;
PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this);
dispatcher->Send(
new PpapiHostMsg_PPBFileChooser_Show(

Powered by Google App Engine
This is Rietveld 408576698