| 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/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/shared_impl/proxy_lock.h" |
| 8 #include "ppapi/shared_impl/tracked_callback.h" | 9 #include "ppapi/shared_impl/tracked_callback.h" |
| 9 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/thunk.h" | 11 #include "ppapi/thunk/thunk.h" |
| 11 #include "ppapi/thunk/ppb_directory_reader_api.h" | 12 #include "ppapi/thunk/ppb_directory_reader_api.h" |
| 12 #include "ppapi/thunk/resource_creation_api.h" | 13 #include "ppapi/thunk/resource_creation_api.h" |
| 13 | 14 |
| 14 namespace ppapi { | 15 namespace ppapi { |
| 15 namespace thunk { | 16 namespace thunk { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 PP_Resource Create(PP_Resource directory_ref) { | 20 PP_Resource Create(PP_Resource directory_ref) { |
| 21 ppapi::ProxyAutoLock lock; |
| 20 Resource* object = | 22 Resource* object = |
| 21 PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref); | 23 PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref); |
| 22 if (!object) | 24 if (!object) |
| 23 return 0; | 25 return 0; |
| 24 EnterResourceCreation enter(object->pp_instance()); | 26 EnterResourceCreationNoLock enter(object->pp_instance()); |
| 25 if (enter.failed()) | 27 if (enter.failed()) |
| 26 return 0; | 28 return 0; |
| 27 return enter.functions()->CreateDirectoryReader(directory_ref); | 29 return enter.functions()->CreateDirectoryReader( |
| 30 object->pp_instance(), directory_ref); |
| 28 } | 31 } |
| 29 | 32 |
| 30 PP_Bool IsDirectoryReader(PP_Resource resource) { | 33 PP_Bool IsDirectoryReader(PP_Resource resource) { |
| 31 EnterResource<PPB_DirectoryReader_API> enter(resource, false); | 34 EnterResource<PPB_DirectoryReader_API> enter(resource, false); |
| 32 return PP_FromBool(enter.succeeded()); | 35 return PP_FromBool(enter.succeeded()); |
| 33 } | 36 } |
| 34 | 37 |
| 35 int32_t GetNextEntry(PP_Resource directory_reader, | 38 int32_t GetNextEntry(PP_Resource directory_reader, |
| 36 PP_DirectoryEntry_Dev* entry, | 39 PP_DirectoryEntry_Dev* entry, |
| 37 PP_CompletionCallback callback) { | 40 PP_CompletionCallback callback) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace | 54 } // namespace |
| 52 | 55 |
| 53 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() { | 56 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() { |
| 54 return &g_ppb_directory_reader_thunk; | 57 return &g_ppb_directory_reader_thunk; |
| 55 } | 58 } |
| 56 | 59 |
| 57 } // namespace thunk | 60 } // namespace thunk |
| 58 } // namespace ppapi | 61 } // namespace ppapi |
| OLD | NEW |