Chromium Code Reviews| Index: ppapi/thunk/ppb_file_ref_thunk.cc |
| diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc |
| index 3c56c5cabc3cfbea44e6ca15773bf0f965f55481..4639ba7ed0fca90426dce12abb86c5c1203a4cc8 100644 |
| --- a/ppapi/thunk/ppb_file_ref_thunk.cc |
| +++ b/ppapi/thunk/ppb_file_ref_thunk.cc |
| @@ -7,6 +7,7 @@ |
| #include "ppapi/c/pp_completion_callback.h" |
| #include "ppapi/c/pp_errors.h" |
| #include "ppapi/c/private/ppb_file_ref_private.h" |
| +#include "ppapi/shared_impl/ppapi_globals.h" |
| #include "ppapi/shared_impl/proxy_lock.h" |
| #include "ppapi/shared_impl/tracked_callback.h" |
| #include "ppapi/thunk/enter.h" |
| @@ -24,10 +25,19 @@ typedef EnterResource<PPB_FileRef_API> EnterFileRef; |
| PP_Resource Create(PP_Resource file_system, const char* path) { |
| ppapi::ProxyAutoLock lock; |
| + |
| + // Make sure the file_system is one of expected types. |
| EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, true); |
| - if (enter_file_system.failed()) |
| + EnterResourceNoLock<PPB_Ext_CrxFileSystem_Private_API> enter_crxfs( |
| + file_system, true); |
| + if (enter_file_system.failed() && enter_crxfs.failed()) |
|
teravest
2013/04/18 16:10:38
I think you want ||, not && here.
victorhsieh
2013/04/18 19:28:38
No, actually at least one of them will be failed.
|
| return 0; |
| - PP_Instance instance = enter_file_system.resource()->pp_instance(); |
| + |
| + // Since file_system is either type of filesystem above, we don't need to |
| + // check null-ness below. |
| + Resource* res = PpapiGlobals::Get()->GetResourceTracker()-> |
| + GetResource(file_system); |
| + PP_Instance instance = res->pp_instance(); |
| EnterResourceCreationNoLock enter(instance); |
| if (enter.failed()) |
| return 0; |