Pepper: Make FileRefResource take a FileSystem ref

FileRefResource needs to hold a reference on the FileSystem resource that it's
passed at creation. This change ensures that happens.

R=yzshen1
BUG=225441

Review URL: https://chromiumcodereview.appspot.com/18389003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210067 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/file_ref_resource.h b/ppapi/proxy/file_ref_resource.h
index 4e4d1b64..82570fbc 100644
--- a/ppapi/proxy/file_ref_resource.h
+++ b/ppapi/proxy/file_ref_resource.h
@@ -15,6 +15,7 @@
 #include "ppapi/proxy/plugin_resource.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/shared_impl/file_ref_create_info.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/thunk/ppb_file_ref_api.h"
 
 namespace ppapi {
@@ -88,6 +89,11 @@
   // Populated after creation.
   FileRef_CreateInfo create_info_;
 
+  // Some file ref operations may fail if the the file system resource inside
+  // create_info_ is destroyed. Therefore, we explicitly hold a reference to
+  // the file system resource to make sure it outlives the file ref.
+  ScopedPPResource file_system_resource_;
+
   scoped_refptr<StringVar> name_var_;
   scoped_refptr<StringVar> path_var_;
   scoped_refptr<StringVar> absolute_path_var_;