diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-28 22:17:15 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-28 22:17:15 +0000 |
commit | 95caad2e61b35b02db3aa2cb8c3b2d58c49a8e37 (patch) | |
tree | 1655b1aecb32691f939ed83f35e4cb9c61c81f2e /webkit | |
parent | d58ff1d5cb29625e031c15f57512bba18a9a46c8 (diff) | |
download | chromium_src-95caad2e61b35b02db3aa2cb8c3b2d58c49a8e37.zip chromium_src-95caad2e61b35b02db3aa2cb8c3b2d58c49a8e37.tar.gz chromium_src-95caad2e61b35b02db3aa2cb8c3b2d58c49a8e37.tar.bz2 |
Don't allow multiple opens for Pepper FileSystem.
BUG=73667
TEST=test_file_system.{h,cc}
Review URL: http://codereview.chromium.org/6596026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_system_impl.cc | 9 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_system_impl.h | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.cc b/webkit/plugins/ppapi/ppb_file_system_impl.cc index 04fc1ae..4abd269 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_system_impl.cc @@ -56,8 +56,10 @@ int32_t Open(PP_Resource file_system_id, if (!file_system) return PP_ERROR_BADRESOURCE; - if (file_system->opened()) - return PP_OK; + // Should not allow multiple opens. + if (file_system->called_open()) + return PP_ERROR_FAILED; + file_system->set_called_open(); if ((file_system->type() != PP_FILESYSTEMTYPE_LOCALPERSISTENT) && (file_system->type() != PP_FILESYSTEMTYPE_LOCALTEMPORARY)) @@ -100,7 +102,8 @@ PPB_FileSystem_Impl::PPB_FileSystem_Impl(PluginInstance* instance, : Resource(instance), instance_(instance), type_(type), - opened_(false) { + opened_(false), + called_open_(false) { DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); } diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.h b/webkit/plugins/ppapi/ppb_file_system_impl.h index 2b3e7af..3ee3756 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.h +++ b/webkit/plugins/ppapi/ppb_file_system_impl.h @@ -32,12 +32,15 @@ class PPB_FileSystem_Impl : public Resource { void set_root_path(const FilePath& root_path) { root_path_ = root_path; } bool opened() const { return opened_; } void set_opened(bool opened) { opened_ = opened; } + bool called_open() const { return called_open_; } + void set_called_open() { called_open_ = true; } private: PluginInstance* instance_; PP_FileSystemType_Dev type_; FilePath root_path_; bool opened_; + bool called_open_; DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Impl); }; |