Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: ppapi/thunk/ppb_file_io_dev_thunk.cc

Issue 69663002: PPAPI: Implement PPB_FileMapping on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build? Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 dev/ppb_file_io_dev.idl modified Thu Oct 17 12:25:57 2013.
bbudge 2014/01/23 23:01:03 Does this file even belong in the patch?
dmichael (off chromium) 2014/01/24 20:02:50 No! Good catch.
6
7 #include "ppapi/c/dev/ppb_file_io_dev.h"
8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppb_file_io_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_Resource file_io,
23 int64_t length,
24 uint32_t map_protection,
25 uint32_t map_flags,
26 int64_t offset,
27 void** address,
28 struct PP_CompletionCallback callback) {
29 VLOG(4) << "PPB_FileIO_Dev::Map()";
30 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
31 if (enter.failed())
32 return enter.retval();
33 return enter.SetResult(enter.object()->Map(length,
34 map_protection,
35 map_flags,
36 offset,
37 address,
38 enter.callback()));
39 }
40
41 void Unmap(PP_Resource file_io, void* address, int64_t length) {
42 VLOG(4) << "PPB_FileIO_Dev::Unmap()";
43 EnterResource<PPB_FileIO_API> enter(file_io, true);
44 if (enter.failed())
45 return;
46 enter.object()->Unmap(address, length);
47 }
48
49 int64_t GetMapPageSize(PP_Resource file_io) {
50 VLOG(4) << "PPB_FileIO_Dev::GetMapPageSize()";
51 EnterResource<PPB_FileIO_API> enter(file_io, true);
52 if (enter.failed())
53 return 0;
54 return enter.object()->GetMapPageSize();
55 }
56
57 const PPB_FileIO_Dev_0_1 g_ppb_fileio_dev_thunk_0_1 = {
58 &Map,
59 &Unmap,
60 &GetMapPageSize
61 };
62
63 } // namespace
64
65 const PPB_FileIO_Dev_0_1* GetPPB_FileIO_Dev_0_1_Thunk() {
66 return &g_ppb_fileio_dev_thunk_0_1;
67 }
68
69 } // namespace thunk
70 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698