OLD | NEW |
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/pp_file_info.h" | 5 #include "ppapi/c/pp_file_info.h" |
6 #include "ppapi/c/ppb_file_ref.h" | 6 #include "ppapi/c/ppb_file_ref.h" |
7 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/private/ppb_file_ref_private.h" | 9 #include "ppapi/c/private/ppb_file_ref_private.h" |
10 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
11 #include "ppapi/thunk/thunk.h" | 11 #include "ppapi/thunk/thunk.h" |
12 #include "ppapi/thunk/ppb_file_ref_api.h" | 12 #include "ppapi/thunk/ppb_file_ref_api.h" |
13 #include "ppapi/thunk/resource_creation_api.h" | 13 #include "ppapi/thunk/resource_creation_api.h" |
14 | 14 |
15 namespace ppapi { | 15 namespace ppapi { |
16 namespace thunk { | 16 namespace thunk { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 typedef EnterResource<PPB_FileRef_API> EnterFileRef; | 20 typedef EnterResource<PPB_FileRef_API> EnterFileRef; |
21 | 21 |
22 PP_Resource Create(PP_Resource file_system, const char* path) { | 22 PP_Resource Create(PP_Resource file_system, const char* path) { |
23 EnterFunctionGivenResource<ResourceCreationAPI> enter(file_system, true); | 23 Resource* object = |
| 24 PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system); |
| 25 if (!object) |
| 26 return 0; |
| 27 EnterResourceCreation enter(object->pp_instance()); |
24 if (enter.failed()) | 28 if (enter.failed()) |
25 return 0; | 29 return 0; |
26 return enter.functions()->CreateFileRef(file_system, path); | 30 return enter.functions()->CreateFileRef(file_system, path); |
27 } | 31 } |
28 | 32 |
29 PP_Bool IsFileRef(PP_Resource resource) { | 33 PP_Bool IsFileRef(PP_Resource resource) { |
30 EnterFileRef enter(resource, false); | 34 EnterFileRef enter(resource, false); |
31 return PP_FromBool(enter.succeeded()); | 35 return PP_FromBool(enter.succeeded()); |
32 } | 36 } |
33 | 37 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() { | 130 const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() { |
127 return &g_ppb_file_ref_thunk; | 131 return &g_ppb_file_ref_thunk; |
128 } | 132 } |
129 | 133 |
130 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { | 134 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { |
131 return &g_ppb_file_ref_private_thunk; | 135 return &g_ppb_file_ref_private_thunk; |
132 } | 136 } |
133 | 137 |
134 } // namespace thunk | 138 } // namespace thunk |
135 } // namespace ppapi | 139 } // namespace ppapi |
OLD | NEW |