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

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

Issue 9113044: Convert to new enter method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove common.h Created 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ppapi/c/dev/ppb_directory_reader_dev.h" 5 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
6 #include "ppapi/c/pp_completion_callback.h" 6 #include "ppapi/c/pp_completion_callback.h"
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/thunk/common.h"
9 #include "ppapi/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/thunk.h" 9 #include "ppapi/thunk/thunk.h"
11 #include "ppapi/thunk/ppb_directory_reader_api.h" 10 #include "ppapi/thunk/ppb_directory_reader_api.h"
12 #include "ppapi/thunk/resource_creation_api.h" 11 #include "ppapi/thunk/resource_creation_api.h"
13 12
14 namespace ppapi { 13 namespace ppapi {
15 namespace thunk { 14 namespace thunk {
16 15
17 namespace { 16 namespace {
18 17
19 PP_Resource Create(PP_Resource directory_ref) { 18 PP_Resource Create(PP_Resource directory_ref) {
20 EnterFunctionGivenResource<ResourceCreationAPI> enter(directory_ref, true); 19 EnterFunctionGivenResource<ResourceCreationAPI> enter(directory_ref, true);
21 if (enter.failed()) 20 if (enter.failed())
22 return 0; 21 return 0;
23 return enter.functions()->CreateDirectoryReader(directory_ref); 22 return enter.functions()->CreateDirectoryReader(directory_ref);
24 } 23 }
25 24
26 PP_Bool IsDirectoryReader(PP_Resource resource) { 25 PP_Bool IsDirectoryReader(PP_Resource resource) {
27 EnterResource<PPB_DirectoryReader_API> enter(resource, false); 26 EnterResource<PPB_DirectoryReader_API> enter(resource, false);
28 return PP_FromBool(enter.succeeded()); 27 return PP_FromBool(enter.succeeded());
29 } 28 }
30 29
31 int32_t GetNextEntry(PP_Resource directory_reader, 30 int32_t GetNextEntry(PP_Resource directory_reader,
32 PP_DirectoryEntry_Dev* entry, 31 PP_DirectoryEntry_Dev* entry,
33 PP_CompletionCallback callback) { 32 PP_CompletionCallback callback) {
34 EnterResource<PPB_DirectoryReader_API> enter(directory_reader, true); 33 EnterResource<PPB_DirectoryReader_API> enter(directory_reader, true);
yzshen1 2012/01/25 19:11:01 Yeah, find one! :)
35 if (enter.failed()) 34 if (enter.failed())
36 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 35 return enter.retval();
37 int32_t result = enter.object()->GetNextEntry(entry, callback); 36 return enter.SetResult(enter.object()->GetNextEntry(entry, callback));
38 return MayForceCallback(callback, result);
39 } 37 }
40 38
41 const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = { 39 const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
42 &Create, 40 &Create,
43 &IsDirectoryReader, 41 &IsDirectoryReader,
44 &GetNextEntry 42 &GetNextEntry
45 }; 43 };
46 44
47 } // namespace 45 } // namespace
48 46
49 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() { 47 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() {
50 return &g_ppb_directory_reader_thunk; 48 return &g_ppb_directory_reader_thunk;
51 } 49 }
52 50
53 } // namespace thunk 51 } // namespace thunk
54 } // namespace ppapi 52 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698