OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // From private/ppb_file_io_private.idl modified Tue Mar 26 15:29:46 2013. | 5 // From private/ppb_file_io_private.idl modified Tue Mar 26 15:29:46 2013. |
6 | 6 |
7 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/private/ppb_file_io_private.h" | 9 #include "ppapi/c/private/ppb_file_io_private.h" |
10 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
12 #include "ppapi/thunk/ppb_file_io_api.h" | 12 #include "ppapi/thunk/ppb_file_io_api.h" |
13 #include "ppapi/thunk/ppb_instance_api.h" | 13 #include "ppapi/thunk/ppb_instance_api.h" |
14 #include "ppapi/thunk/resource_creation_api.h" | 14 #include "ppapi/thunk/resource_creation_api.h" |
15 #include "ppapi/thunk/thunk.h" | 15 #include "ppapi/thunk/thunk.h" |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 namespace thunk { | 18 namespace thunk { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 int32_t RequestOSFileHandle(PP_Resource file_io, | 22 int32_t RequestOSFileHandle(PP_Resource file_io, |
23 PP_FileHandle* handle, | 23 PP_FileHandle* handle, |
24 struct PP_CompletionCallback callback) { | 24 struct PP_CompletionCallback callback) { |
25 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); | 25 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); |
26 if (enter.failed()) | 26 if (enter.failed()) |
27 return enter.retval(); | 27 return enter.retval(); |
28 return enter.SetResult(enter.object()->RequestOSFileHandle( | 28 return enter.SetResult( |
29 handle, | 29 enter.object()->RequestOSFileHandle(handle, enter.callback())); |
30 enter.callback())); | |
31 } | 30 } |
32 | 31 |
33 const PPB_FileIO_Private_0_1 g_ppb_fileio_private_thunk_0_1 = { | 32 const PPB_FileIO_Private_0_1 g_ppb_fileio_private_thunk_0_1 = { |
34 &RequestOSFileHandle | 33 &RequestOSFileHandle}; |
35 }; | |
36 | 34 |
37 } // namespace | 35 } // namespace |
38 | 36 |
39 const PPB_FileIO_Private_0_1* GetPPB_FileIO_Private_0_1_Thunk() { | 37 const PPB_FileIO_Private_0_1* GetPPB_FileIO_Private_0_1_Thunk() { |
40 return &g_ppb_fileio_private_thunk_0_1; | 38 return &g_ppb_fileio_private_thunk_0_1; |
41 } | 39 } |
42 | 40 |
43 } // namespace thunk | 41 } // namespace thunk |
44 } // namespace ppapi | 42 } // namespace ppapi |
OLD | NEW |