1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
8 #include "ppapi/shared_impl/tracked_callback.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/thunk.h"
11 #include "ppapi/thunk/ppb_file_io_api.h"
12 #include "ppapi/thunk/resource_creation_api.h"
19 typedef EnterResource
<PPB_FileIO_API
> EnterFileIO
;
21 int32_t GetOSFileDescriptor(PP_Resource file_io
) {
22 EnterFileIO
enter(file_io
, true);
24 return enter
.retval();
25 return enter
.object()->GetOSFileDescriptor();
28 int32_t WillWrite(PP_Resource file_io
,
30 int32_t bytes_to_write
,
31 PP_CompletionCallback callback
) {
32 EnterFileIO
enter(file_io
, callback
, true);
34 return enter
.retval();
35 return enter
.SetResult(enter
.object()->WillWrite(offset
, bytes_to_write
,
39 int32_t WillSetLength(PP_Resource file_io
,
41 PP_CompletionCallback callback
) {
42 EnterFileIO
enter(file_io
, callback
, true);
44 return enter
.retval();
45 return enter
.SetResult(enter
.object()->WillSetLength(length
,
49 const PPB_FileIOTrusted g_ppb_file_io_trusted_thunk
= {
57 const PPB_FileIOTrusted_0_4
* GetPPB_FileIOTrusted_0_4_Thunk() {
58 return &g_ppb_file_io_trusted_thunk
;