NaCl docs: update release notes for 42 branch
[chromium-blink-merge.git] / ppapi / thunk / ppb_file_mapping_thunk.cc
blob627b497b8459dddf8dd6154cc78b25b786919deb
1 // Copyright 2014 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 // From ppb_file_mapping.idl modified Mon Apr 7 08:55:47 2014.
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/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_file_mapping_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 int32_t Map(PP_Instance instance,
21 PP_Resource file_io,
22 int64_t length,
23 uint32_t map_protection,
24 uint32_t map_flags,
25 int64_t offset,
26 void** address,
27 struct PP_CompletionCallback callback) {
28 VLOG(4) << "PPB_FileMapping::Map()";
29 EnterInstanceAPI<PPB_FileMapping_API> enter(instance, callback);
30 if (enter.failed())
31 return enter.retval();
32 return enter.SetResult(
33 enter.functions()->Map(instance, file_io, length, map_protection,
34 map_flags, offset, address, enter.callback()));
37 int32_t Unmap(PP_Instance instance,
38 const void* address,
39 int64_t length,
40 struct PP_CompletionCallback callback) {
41 VLOG(4) << "PPB_FileMapping::Unmap()";
42 EnterInstanceAPI<PPB_FileMapping_API> enter(instance, callback);
43 if (enter.failed())
44 return enter.retval();
45 return enter.SetResult(
46 enter.functions()->Unmap(instance, address, length, enter.callback()));
49 int64_t GetMapPageSize(PP_Instance instance) {
50 VLOG(4) << "PPB_FileMapping::GetMapPageSize()";
51 EnterInstanceAPI<PPB_FileMapping_API> enter(instance);
52 if (enter.failed())
53 return 0;
54 return enter.functions()->GetMapPageSize(instance);
57 const PPB_FileMapping_0_1 g_ppb_filemapping_thunk_0_1 = {&Map,
58 &Unmap,
59 &GetMapPageSize};
61 } // namespace
63 PPAPI_THUNK_EXPORT const PPB_FileMapping_0_1* GetPPB_FileMapping_0_1_Thunk() {
64 return &g_ppb_filemapping_thunk_0_1;
67 } // namespace thunk
68 } // namespace ppapi