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

Unified Diff: ppapi/thunk/ppb_file_io_trusted_thunk.cc

Issue 9113044: Convert to new enter method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PATCH DESCRIPTIONS ARE A STUPID WASTE OF TIME Created 8 years, 11 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/thunk/ppb_file_io_thunk.cc ('k') | ppapi/thunk/ppb_file_ref_thunk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_file_io_trusted_thunk.cc
diff --git a/ppapi/thunk/ppb_file_io_trusted_thunk.cc b/ppapi/thunk/ppb_file_io_trusted_thunk.cc
index 709af4379598863ca435eb13cedb2192c3de43ec..c291ec8c9869171687990393b13dc9dfee2f0669 100644
--- a/ppapi/thunk/ppb_file_io_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_file_io_trusted_thunk.cc
@@ -5,7 +5,6 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
-#include "ppapi/thunk/common.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_file_io_api.h"
@@ -16,32 +15,33 @@ namespace thunk {
namespace {
+typedef EnterResource<PPB_FileIO_API> EnterFileIO;
+
int32_t GetOSFileDescriptor(PP_Resource file_io) {
- EnterResource<PPB_FileIO_API> enter(file_io, true);
+ EnterFileIO enter(file_io, true);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->GetOSFileDescriptor();
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetOSFileDescriptor());
}
int32_t WillWrite(PP_Resource file_io,
int64_t offset,
int32_t bytes_to_write,
PP_CompletionCallback callback) {
- EnterResource<PPB_FileIO_API> enter(file_io, true);
+ EnterFileIO enter(file_io, callback, true);
if (enter.failed())
- return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
- int32_t result = enter.object()->WillWrite(offset, bytes_to_write, callback);
- return MayForceCallback(callback, result);
+ return enter.retval();
+ return enter.SetResult(enter.object()->WillWrite(offset, bytes_to_write,
+ callback));
}
int32_t WillSetLength(PP_Resource file_io,
int64_t length,
PP_CompletionCallback callback) {
- EnterResource<PPB_FileIO_API> enter(file_io, true);
+ EnterFileIO enter(file_io, callback, true);
if (enter.failed())
- return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
- int32_t result = enter.object()->WillSetLength(length, callback);
- return MayForceCallback(callback, result);
+ return enter.retval();
+ return enter.SetResult(enter.object()->WillSetLength(length, callback));
}
const PPB_FileIOTrusted g_ppb_file_io_trusted_thunk = {
« no previous file with comments | « ppapi/thunk/ppb_file_io_thunk.cc ('k') | ppapi/thunk/ppb_file_ref_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698