OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // From ppb_file_mapping.idl modified Tue Dec 17 13:54:30 2013. |
| 6 |
| 7 #include "ppapi/c/pp_completion_callback.h" |
| 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/c/ppb_file_mapping.h" |
| 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 11 #include "ppapi/thunk/enter.h" |
| 12 #include "ppapi/thunk/ppb_file_mapping_api.h" |
| 13 #include "ppapi/thunk/ppb_instance_api.h" |
| 14 #include "ppapi/thunk/resource_creation_api.h" |
| 15 #include "ppapi/thunk/thunk.h" |
| 16 |
| 17 namespace ppapi { |
| 18 namespace thunk { |
| 19 |
| 20 namespace { |
| 21 |
| 22 int32_t Map(PP_Instance instance, |
| 23 PP_Resource file_io, |
| 24 int64_t length, |
| 25 uint32_t map_protection, |
| 26 uint32_t map_flags, |
| 27 int64_t offset, |
| 28 void** address, |
| 29 struct PP_CompletionCallback callback) { |
| 30 VLOG(4) << "PPB_FileMapping::Map()"; |
| 31 EnterInstanceAPI<PPB_FileMapping_API> enter(instance, callback); |
| 32 if (enter.failed()) |
| 33 return enter.retval(); |
| 34 return enter.SetResult(enter.functions()->Map(instance, |
| 35 file_io, |
| 36 length, |
| 37 map_protection, |
| 38 map_flags, |
| 39 offset, |
| 40 address, |
| 41 enter.callback())); |
| 42 } |
| 43 |
| 44 void Unmap(PP_Instance file_io, void* address, int64_t length) { |
| 45 VLOG(4) << "PPB_FileMapping::Unmap()"; |
| 46 EnterInstanceAPI<PPB_FileMapping_API> enter(file_io); |
| 47 if (enter.failed()) |
| 48 return; |
| 49 enter.functions()->Unmap(file_io, address, length); |
| 50 } |
| 51 |
| 52 int64_t GetMapPageSize(PP_Instance file_io) { |
| 53 VLOG(4) << "PPB_FileMapping::GetMapPageSize()"; |
| 54 EnterInstanceAPI<PPB_FileMapping_API> enter(file_io); |
| 55 if (enter.failed()) |
| 56 return 0; |
| 57 return enter.functions()->GetMapPageSize(file_io); |
| 58 } |
| 59 |
| 60 const PPB_FileMapping_0_1 g_ppb_filemapping_thunk_0_1 = { |
| 61 &Map, |
| 62 &Unmap, |
| 63 &GetMapPageSize |
| 64 }; |
| 65 |
| 66 } // namespace |
| 67 |
| 68 const PPB_FileMapping_0_1* GetPPB_FileMapping_0_1_Thunk() { |
| 69 return &g_ppb_filemapping_thunk_0_1; |
| 70 } |
| 71 |
| 72 } // namespace thunk |
| 73 } // namespace ppapi |
OLD | NEW |