diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-21 23:49:16 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-21 23:49:16 +0000 |
commit | ce482dfe397df7f7c06901ade9f35b10fd32aa94 (patch) | |
tree | 88e2dca000032b47b12edfa908c8e8ec0f4ddab3 /webkit | |
parent | 563532cca9b9c670f77c16b70034e4fe2aad7e7e (diff) | |
download | chromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.zip chromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.tar.gz chromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.tar.bz2 |
Implement the filesystem proxy. This allows the FileRef tests (the ones which
don't use FileIO which isn't don yet) to pass in the proxy.
Hook up the code from the URLLoader that downloads to a file. This allows all
URLLoader tests to pass in the proxy.
Change code in dispatcher that zeros out the array to take into account
padding. It was only zero-filling half of the array since sizeof(enum) * # elts
seems to be half as large as the actual array due to padding on 64-bit systems.
Make the aborted completion callbacks run asynchronously. This was caught by
one of the file ref tests. We really need a system for doing this better, but
I don't want to do that in this patch.
TEST=ppapi_tests run under proxy
Review URL: http://codereview.chromium.org/6543028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_ref_impl.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_system_impl.cc | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc index 1607299..55bf3f1 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc @@ -68,7 +68,7 @@ PP_FileSystemType_Dev GetFileSystemType(PP_Resource file_ref_id) { scoped_refptr<PPB_FileRef_Impl> file_ref( Resource::GetAs<PPB_FileRef_Impl>(file_ref_id)); if (!file_ref) - return PP_FILESYSTEMTYPE_EXTERNAL; + return PP_FILESYSTEMTYPE_INVALID; return file_ref->GetFileSystemType(); } @@ -307,6 +307,8 @@ scoped_refptr<PPB_FileSystem_Impl> PPB_FileRef_Impl::GetFileSystem() const { } PP_FileSystemType_Dev PPB_FileRef_Impl::GetFileSystemType() const { + // When the file ref exists but there's no explicit filesystem object + // associated with it, that means it's an "external" filesystem. if (!file_system_) return PP_FILESYSTEMTYPE_EXTERNAL; diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.cc b/webkit/plugins/ppapi/ppb_file_system_impl.cc index 602e21b..04fc1ae 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_system_impl.cc @@ -12,6 +12,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" #include "webkit/fileapi/file_system_types.h" +#include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/file_callbacks.h" #include "webkit/plugins/ppapi/plugin_delegate.h" #include "webkit/plugins/ppapi/plugin_module.h" @@ -31,11 +32,22 @@ PP_Resource Create(PP_Instance instance, PP_FileSystemType_Dev type) { if (!plugin_instance) return 0; + if (type != PP_FILESYSTEMTYPE_EXTERNAL && + type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && + type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) + return 0; + PPB_FileSystem_Impl* file_system = new PPB_FileSystem_Impl(plugin_instance, type); return file_system->GetReference(); } +PP_Bool IsFileSystem(PP_Resource resource) { + scoped_refptr<PPB_FileSystem_Impl> file_system( + Resource::GetAs<PPB_FileSystem_Impl>(resource)); + return BoolToPPBool(!!file_system.get()); +} + int32_t Open(PP_Resource file_system_id, int64 expected_size, PP_CompletionCallback callback) { @@ -66,9 +78,19 @@ int32_t Open(PP_Resource file_system_id, return PP_ERROR_WOULDBLOCK; } +PP_FileSystemType_Dev GetType(PP_Resource resource) { + scoped_refptr<PPB_FileSystem_Impl> file_system( + Resource::GetAs<PPB_FileSystem_Impl>(resource)); + if (!file_system) + return PP_FILESYSTEMTYPE_INVALID; + return file_system->type(); +} + const PPB_FileSystem_Dev ppb_filesystem = { &Create, - &Open + &IsFileSystem, + &Open, + &GetType }; } // namespace @@ -79,6 +101,7 @@ PPB_FileSystem_Impl::PPB_FileSystem_Impl(PluginInstance* instance, instance_(instance), type_(type), opened_(false) { + DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); } PPB_FileSystem_Impl* PPB_FileSystem_Impl::AsPPB_FileSystem_Impl() { |