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..986a3c0b48d2ecd9830e17b7a879a30774ed1fdf 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; |
- EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, true); |
- if (enter_file_system.failed()) |
+ |
+ // Make sure the file_system is one of the expected types. |
+ EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, false); |
+ EnterResourceNoLock<PPB_Ext_CrxFileSystem_Private_API> enter_crxfs( |
yzshen1
2013/05/02 23:22:01
You don't need this anymore.
victorhsieh
2013/05/03 17:26:58
Done.
|
+ file_system, false); |
+ if (enter_file_system.failed() && enter_crxfs.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; |