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

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

Issue 7082036: Convert more interfaces to the new thunk system. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
6 #include "ppapi/c/pp_completion_callback.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/thunk/thunk.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_directory_reader_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
12
13 namespace ppapi {
14 namespace thunk {
15
16 namespace {
17
18 PP_Resource Create(PP_Resource directory_ref) {
19 EnterFunctionGivenResource<ResourceCreationAPI> enter(directory_ref, true);
20 if (enter.failed())
21 return 0;
22 return enter.functions()->CreateDirectoryReader(directory_ref);
23 }
24
25 PP_Bool IsDirectoryReader(PP_Resource resource) {
26 EnterResource<PPB_DirectoryReader_API> enter(resource, false);
27 return PP_FromBool(enter.succeeded());
28 }
29
30 int32_t GetNextEntry(PP_Resource directory_reader,
31 PP_DirectoryEntry_Dev* entry,
32 PP_CompletionCallback callback) {
33 EnterResource<PPB_DirectoryReader_API> enter(directory_reader, true);
34 if (enter.failed())
35 return PP_ERROR_BADRESOURCE;
36 return enter.object()->GetNextEntry(entry, callback);
37 }
38
39 const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
40 &Create,
41 &IsDirectoryReader,
42 &GetNextEntry
43 };
44
45 } // namespace
46
47 const PPB_DirectoryReader_Dev* GetPPB_DirectoryReader_Thunk() {
48 return &g_ppb_directory_reader_thunk;
49 }
50
51 } // namespace thunk
52 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698