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) |
yzshen1
2013/01/24 21:55:43
You could move this check into CreateDirectoryRead
nhiroki
2013/01/25 12:27:17
I see. I removed GetResource() from CreateDirector
| |
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(directory_ref); |
28 } | 30 } |
29 | 31 |
30 PP_Bool IsDirectoryReader(PP_Resource resource) { | 32 PP_Bool IsDirectoryReader(PP_Resource resource) { |
31 EnterResource<PPB_DirectoryReader_API> enter(resource, false); | 33 EnterResource<PPB_DirectoryReader_API> enter(resource, false); |
32 return PP_FromBool(enter.succeeded()); | 34 return PP_FromBool(enter.succeeded()); |
33 } | 35 } |
34 | 36 |
(...skipping 14 matching lines...) Expand all Loading... | |
49 }; | 51 }; |
50 | 52 |
51 } // namespace | 53 } // namespace |
52 | 54 |
53 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() { | 55 const PPB_DirectoryReader_Dev_0_5* GetPPB_DirectoryReader_Dev_0_5_Thunk() { |
54 return &g_ppb_directory_reader_thunk; | 56 return &g_ppb_directory_reader_thunk; |
55 } | 57 } |
56 | 58 |
57 } // namespace thunk | 59 } // namespace thunk |
58 } // namespace ppapi | 60 } // namespace ppapi |
OLD | NEW |