Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: webkit/plugins/ppapi/ppb_file_ref_impl.h

Issue 13726024: Refactor FileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NON_EXPORTED_BASE Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/plugin_delegate.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_file_ref_impl.h
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.h b/webkit/plugins/ppapi/ppb_file_ref_impl.h
index 1b99969703904ad2e27c8999b6eecfbfd4a38921..5d6bccf2787b48c261fcc68553388e567c5a96c7 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.h
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.h
@@ -12,6 +12,7 @@
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/shared_impl/ppb_file_ref_shared.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/var.h"
#include "webkit/glue/webkit_glue_export.h"
@@ -26,19 +27,21 @@ class WEBKIT_GLUE_EXPORT PPB_FileRef_Impl
: public ::ppapi::PPB_FileRef_Shared {
public:
PPB_FileRef_Impl(const ::ppapi::PPB_FileRef_CreateInfo& info,
- PPB_FileSystem_Impl* file_system);
+ PP_Resource file_system);
PPB_FileRef_Impl(const ::ppapi::PPB_FileRef_CreateInfo& info,
const base::FilePath& external_file_path);
virtual ~PPB_FileRef_Impl();
// The returned object will have a refcount of 0 (just like "new").
- static PPB_FileRef_Impl* CreateInternal(PP_Resource pp_file_system,
+ static PPB_FileRef_Impl* CreateInternal(PP_Instance instance,
+ PP_Resource pp_file_system,
const std::string& path);
// The returned object will have a refcount of 0 (just like "new").
- static PPB_FileRef_Impl* CreateExternal(PP_Instance instance,
- const base::FilePath& external_file_path,
- const std::string& display_name);
+ static PPB_FileRef_Impl* CreateExternal(
+ PP_Instance instance,
+ const base::FilePath& external_file_path,
+ const std::string& display_name);
// PPB_FileRef_API implementation (not provided by PPB_FileRef_Shared).
virtual PP_Resource GetParent() OVERRIDE;
@@ -59,7 +62,7 @@ class WEBKIT_GLUE_EXPORT PPB_FileRef_Impl
scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE;
virtual PP_Var GetAbsolutePath();
- PPB_FileSystem_Impl* file_system() const { return file_system_.get(); }
+ PP_Resource file_system_resource() const { return file_system_; }
// Returns the system path corresponding to this file. Valid only for
// external filesystems.
@@ -70,14 +73,31 @@ class WEBKIT_GLUE_EXPORT PPB_FileRef_Impl
// Checks if file ref has file system instance and if the instance is opened.
bool HasValidFileSystem() const;
+
+ void AddFileSystemRefCount() {
+ file_system_ref_ = file_system_;
+ }
+
private:
// Many mutation functions are allow only to non-external filesystems, This
// function returns true if the filesystem is opened and isn't external as an
// access check for these functions.
bool IsValidNonExternalFileSystem() const;
- // Null for external filesystems.
- scoped_refptr<PPB_FileSystem_Impl> file_system_;
+ // 0 for external filesystems. This is a plugin side resource that we don't
+ // hold a reference here, so file_system_ could be destroyed earlier than
+ // this object. Right now we checked the existance in plugin delegate before
+ // use. But it's better to hold a reference once we migrate FileRef to the
+ // new design.
+ PP_Resource file_system_;
+
+ // Holds a reference of FileSystem when running in process. See
+ // PPB_FileRef_Proxy for corresponding code for out-of-process mode. Note
+ // that this ScopedPPResource is only expected to be used when running in
+ // process (since PPB_FileRef_Proxy takes care of out-of-process case).
+ // Also note that this workaround will be no longer needed after FileRef
+ // refactoring.
+ ::ppapi::ScopedPPResource file_system_ref_;
// Used only for external filesystems.
base::FilePath external_file_system_path_;
« no previous file with comments | « webkit/plugins/ppapi/plugin_delegate.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698