summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 16:16:00 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 16:16:00 +0000
commit8573b3339aa26a4083a7d30abc8953ee5fbb0daf (patch)
tree79951d6129d8bba0dec9e565355d9493403e4653 /webkit
parent60a55109c391fcab1ff41b60b5394a6ae3d09bbc (diff)
downloadchromium_src-8573b3339aa26a4083a7d30abc8953ee5fbb0daf.zip
chromium_src-8573b3339aa26a4083a7d30abc8953ee5fbb0daf.tar.gz
chromium_src-8573b3339aa26a4083a7d30abc8953ee5fbb0daf.tar.bz2
AppendFileToBody by blocking ipc
Another version of change to fix PPB_URLRequestInfo::AppendFileToBody using synchronous IPC. BUG=90878 TEST=PPAPITest.TestURLLoader Review URL: http://codereview.chromium.org/7618039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc7
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h2
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h4
-rw-r--r--webkit/plugins/ppapi/ppb_file_ref_impl.h3
-rw-r--r--webkit/plugins/ppapi/ppb_file_system_impl.h2
-rw-r--r--webkit/plugins/ppapi/ppb_url_request_info_impl.cc25
6 files changed, 37 insertions, 6 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index fb2d1a7..543c21e 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -188,6 +188,13 @@ base::PlatformFileError MockPluginDelegate::GetDirContents(
return base::PLATFORM_FILE_ERROR_FAILED;
}
+void MockPluginDelegate::SyncGetFileSystemPlatformPath(
+ const GURL& url,
+ FilePath* platform_path) {
+ DCHECK(platform_path);
+ *platform_path = FilePath();
+}
+
void MockPluginDelegate::PublishPolicy(const std::string& policy_json) {
}
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 9de0218..3d4a034 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -84,6 +84,8 @@ class MockPluginDelegate : public PluginDelegate {
base::PlatformFileInfo* info);
virtual base::PlatformFileError GetDirContents(const PepperFilePath& path,
DirContents* contents);
+ virtual void SyncGetFileSystemPlatformPath(const GURL& url,
+ FilePath* platform_path);
virtual void PublishPolicy(const std::string& policy_json);
virtual scoped_refptr<base::MessageLoopProxy>
GetFileThreadMessageLoopProxy();
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 38e6591..fcbf296 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -363,6 +363,10 @@ class PluginDelegate {
virtual base::PlatformFileError GetDirContents(const PepperFilePath& path,
DirContents* contents) = 0;
+ // Synchronously returns the platform file path for a filesystem URL.
+ virtual void SyncGetFileSystemPlatformPath(const GURL& url,
+ FilePath* platform_path) = 0;
+
// Returns a MessageLoopProxy instance associated with the message loop
// of the file thread in this renderer.
virtual scoped_refptr<base::MessageLoopProxy>
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.h b/webkit/plugins/ppapi/ppb_file_ref_impl.h
index b1b4d95..fa3bfbd 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.h
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.h
@@ -54,9 +54,10 @@ class PPB_FileRef_Impl : public Resource,
PP_CompletionCallback callback) OVERRIDE;
PPB_FileSystem_Impl* file_system() const { return file_system_.get(); }
- const std::string& virtual_path() const { return virtual_path_; }
// Returns the virtual path (i.e., the path that the pepper plugin sees)
+ const std::string& virtual_path() const { return virtual_path_; }
+
// Returns the system path corresponding to this file.
FilePath GetSystemPath() const;
diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.h b/webkit/plugins/ppapi/ppb_file_system_impl.h
index 4c425db..b14685d 100644
--- a/webkit/plugins/ppapi/ppb_file_system_impl.h
+++ b/webkit/plugins/ppapi/ppb_file_system_impl.h
@@ -32,7 +32,7 @@ class PPB_FileSystem_Impl : public Resource,
virtual ::ppapi::thunk::PPB_FileSystem_API* AsPPB_FileSystem_API() OVERRIDE;
PluginInstance* instance() { return instance_; }
- PP_FileSystemType type() { return type_; }
+ PP_FileSystemType type() const { return type_; }
const GURL& root_url() const { return root_url_; }
void set_root_url(const GURL& root_url) { root_url_ = root_url; }
bool opened() const { return opened_; }
diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
index 957d62b..8820a41 100644
--- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
@@ -19,11 +19,13 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPBody.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/plugin_module.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
+#include "webkit/plugins/ppapi/ppb_file_system_impl.h"
#include "webkit/plugins/ppapi/string.h"
-#include "webkit/glue/webkit_glue.h"
using ppapi::StringVar;
using ppapi::thunk::EnterResourceNoLock;
@@ -157,7 +159,7 @@ bool AreValidHeaders(const std::string& headers) {
} // namespace
struct PPB_URLRequestInfo_Impl::BodyItem {
- BodyItem(const std::string& data)
+ explicit BodyItem(const std::string& data)
: data(data),
start_offset(0),
number_of_bytes(-1),
@@ -287,9 +289,24 @@ WebURLRequest PPB_URLRequestInfo_Impl::ToWebURLRequest(WebFrame* frame) const {
http_body.initialize();
for (size_t i = 0; i < body_.size(); ++i) {
if (body_[i].file_ref) {
+ FilePath platform_path;
+ switch (body_[i].file_ref->file_system()->type()) {
+ case PP_FILESYSTEMTYPE_LOCALTEMPORARY:
+ case PP_FILESYSTEMTYPE_LOCALPERSISTENT:
+ // TODO(kinuko): remove this sync IPC when we add more generic
+ // AppendURLRange solution that works for both Blob/FileSystem URL.
+ instance()->delegate()->SyncGetFileSystemPlatformPath(
+ body_[i].file_ref->GetFileSystemURL(),
+ &platform_path);
+ break;
+ case PP_FILESYSTEMTYPE_EXTERNAL:
+ platform_path = body_[i].file_ref->GetSystemPath();
+ break;
+ default:
+ NOTREACHED();
+ }
http_body.appendFileRange(
- webkit_glue::FilePathToWebString(
- body_[i].file_ref->GetSystemPath()),
+ webkit_glue::FilePathToWebString(platform_path),
body_[i].start_offset,
body_[i].number_of_bytes,
body_[i].expected_last_modified_time);