| 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 = {
|
|
|