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/shared_impl/proxy_lock.h" | 10 #include "ppapi/shared_impl/proxy_lock.h" |
11 #include "ppapi/shared_impl/tracked_callback.h" | 11 #include "ppapi/shared_impl/tracked_callback.h" |
12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
13 #include "ppapi/thunk/thunk.h" | 13 #include "ppapi/thunk/thunk.h" |
14 #include "ppapi/thunk/ppb_file_ref_api.h" | 14 #include "ppapi/thunk/ppb_file_ref_api.h" |
15 #include "ppapi/thunk/ppb_file_system_api.h" | |
15 #include "ppapi/thunk/resource_creation_api.h" | 16 #include "ppapi/thunk/resource_creation_api.h" |
16 | 17 |
17 namespace ppapi { | 18 namespace ppapi { |
18 namespace thunk { | 19 namespace thunk { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 typedef EnterResource<PPB_FileRef_API> EnterFileRef; | 23 typedef EnterResource<PPB_FileRef_API> EnterFileRef; |
23 | 24 |
24 PP_Resource Create(PP_Resource file_system, const char* path) { | 25 PP_Resource Create(PP_Resource file_system, const char* path) { |
25 ppapi::ProxyAutoLock lock; | 26 ppapi::ProxyAutoLock lock; |
26 Resource* object = | 27 EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, false); |
yzshen1
2013/04/08 21:05:16
nit: shall we use 'true' instead of 'false' here?
victorhsieh
2013/04/08 23:44:38
Done.
| |
27 PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system); | 28 if (enter_file_system.failed()) |
28 if (!object) | |
29 return 0; | 29 return 0; |
30 EnterResourceCreationNoLock enter(object->pp_instance()); | 30 PP_Instance instance = enter_file_system.resource()->pp_instance(); |
31 EnterResourceCreationNoLock enter(instance); | |
31 if (enter.failed()) | 32 if (enter.failed()) |
32 return 0; | 33 return 0; |
33 return enter.functions()->CreateFileRef(file_system, path); | 34 return enter.functions()->CreateFileRef(instance, file_system, path); |
34 } | 35 } |
35 | 36 |
36 PP_Bool IsFileRef(PP_Resource resource) { | 37 PP_Bool IsFileRef(PP_Resource resource) { |
37 EnterFileRef enter(resource, false); | 38 EnterFileRef enter(resource, false); |
38 return PP_FromBool(enter.succeeded()); | 39 return PP_FromBool(enter.succeeded()); |
39 } | 40 } |
40 | 41 |
41 PP_FileSystemType GetFileSystemType(PP_Resource file_ref) { | 42 PP_FileSystemType GetFileSystemType(PP_Resource file_ref) { |
42 EnterFileRef enter(file_ref, true); | 43 EnterFileRef enter(file_ref, true); |
43 if (enter.failed()) | 44 if (enter.failed()) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() { | 163 const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() { |
163 return &g_ppb_file_ref_thunk_1_1; | 164 return &g_ppb_file_ref_thunk_1_1; |
164 } | 165 } |
165 | 166 |
166 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { | 167 const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { |
167 return &g_ppb_file_ref_private_thunk; | 168 return &g_ppb_file_ref_private_thunk; |
168 } | 169 } |
169 | 170 |
170 } // namespace thunk | 171 } // namespace thunk |
171 } // namespace ppapi | 172 } // namespace ppapi |
OLD | NEW |