diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 16:16:00 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 16:16:00 +0000 |
commit | 8573b3339aa26a4083a7d30abc8953ee5fbb0daf (patch) | |
tree | 79951d6129d8bba0dec9e565355d9493403e4653 /content | |
parent | 60a55109c391fcab1ff41b60b5394a6ae3d09bbc (diff) | |
download | chromium_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 'content')
5 files changed, 52 insertions, 0 deletions
diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc index a66e9f8..8d886dc 100644 --- a/content/browser/file_system/file_system_dispatcher_host.cc +++ b/content/browser/file_system/file_system_dispatcher_host.cc @@ -25,7 +25,9 @@ #include "webkit/fileapi/file_system_util.h" using fileapi::FileSystemCallbackDispatcher; +using fileapi::FileSystemFileUtil; using fileapi::FileSystemOperation; +using fileapi::FileSystemOperationContext; class BrowserFileSystemCallbackDispatcher : public FileSystemCallbackDispatcher { @@ -126,6 +128,13 @@ void FileSystemDispatcherHost::OnChannelConnected(int32 peer_pid) { DCHECK(context_); } +void FileSystemDispatcherHost::OverrideThreadForMessage( + const IPC::Message& message, + BrowserThread::ID* thread) { + if (message.type() == FileSystemHostMsg_SyncGetPlatformPath::ID) + *thread = BrowserThread::FILE; +} + bool FileSystemDispatcherHost::OnMessageReceived( const IPC::Message& message, bool* message_was_ok) { *message_was_ok = true; @@ -146,6 +155,8 @@ bool FileSystemDispatcherHost::OnMessageReceived( IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile) IPC_MESSAGE_HANDLER(FileSystemHostMsg_WillUpdate, OnWillUpdate) IPC_MESSAGE_HANDLER(FileSystemHostMsg_DidUpdate, OnDidUpdate) + IPC_MESSAGE_HANDLER(FileSystemHostMsg_SyncGetPlatformPath, + OnSyncGetPlatformPath) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() return handled; @@ -269,6 +280,28 @@ void FileSystemDispatcherHost::OnDidUpdate(const GURL& path, int64 delta) { quota_util->proxy()->EndUpdateOrigin(origin_url, type); } +void FileSystemDispatcherHost::OnSyncGetPlatformPath( + const GURL& path, FilePath* platform_path) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + DCHECK(platform_path); + *platform_path = FilePath(); + base::PlatformFileInfo info; + GURL origin_url; + fileapi::FileSystemType type; + FilePath virtual_path; + if (!CrackFileSystemURL(path, &origin_url, &type, &virtual_path)) + return; + FileSystemFileUtil* file_util = + context_->path_manager()->GetFileSystemFileUtil(type); + if (!file_util) + return; + FileSystemOperationContext operation_context(context_, file_util); + operation_context.set_src_origin_url(origin_url); + operation_context.set_src_type(type); + file_util->GetFileInfo(&operation_context, virtual_path, + &info, platform_path); +} + FileSystemOperation* FileSystemDispatcherHost::GetNewOperation( int request_id) { BrowserFileSystemCallbackDispatcher* dispatcher = diff --git a/content/browser/file_system/file_system_dispatcher_host.h b/content/browser/file_system/file_system_dispatcher_host.h index 956fc43..3d64d40 100644 --- a/content/browser/file_system/file_system_dispatcher_host.h +++ b/content/browser/file_system/file_system_dispatcher_host.h @@ -12,6 +12,7 @@ #include "content/browser/browser_message_filter.h" #include "webkit/fileapi/file_system_types.h" +class FilePath; class GURL; class Receiver; class RenderMessageFilter; @@ -45,6 +46,8 @@ class FileSystemDispatcherHost : public BrowserMessageFilter { // BrowserMessageFilter implementation. virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + virtual void OverrideThreadForMessage(const IPC::Message& message, + BrowserThread::ID* thread) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -84,6 +87,8 @@ class FileSystemDispatcherHost : public BrowserMessageFilter { void OnOpenFile(int request_id, const GURL& path, int file_flags); void OnWillUpdate(const GURL& path); void OnDidUpdate(const GURL& path, int64 delta); + void OnSyncGetPlatformPath(const GURL& path, + FilePath* platform_path); // Creates a new FileSystemOperation. fileapi::FileSystemOperation* GetNewOperation(int request_id); diff --git a/content/common/file_system_messages.h b/content/common/file_system_messages.h index 5147caf..38504f6 100644 --- a/content/common/file_system_messages.h +++ b/content/common/file_system_messages.h @@ -133,6 +133,11 @@ IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenFile, GURL /* file path */, int /* file flags */) +// For Pepper's URL loader. +IPC_SYNC_MESSAGE_CONTROL1_1(FileSystemHostMsg_SyncGetPlatformPath, + GURL /* file path */, + FilePath /* platform_path */) + // Pre- and post-update notifications for ppapi implementation. IPC_MESSAGE_CONTROL1(FileSystemHostMsg_WillUpdate, GURL /* file_path */) diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index 08d8282..2678694 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -1234,6 +1234,12 @@ base::PlatformFileError PepperPluginDelegateImpl::GetDirContents( return error; } +void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( + const GURL& url, FilePath* platform_path) { + RenderThread::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( + url, platform_path)); +} + scoped_refptr<base::MessageLoopProxy> PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { return RenderThread::current()->GetFileThreadMessageLoopProxy(); diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h index 008a0fd..2633be1 100644 --- a/content/renderer/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper_plugin_delegate_impl.h @@ -251,6 +251,9 @@ class PepperPluginDelegateImpl virtual base::PlatformFileError GetDirContents( const webkit::ppapi::PepperFilePath& path, webkit::ppapi::DirContents* contents) OVERRIDE; + virtual void SyncGetFileSystemPlatformPath( + const GURL& url, + FilePath* platform_path) OVERRIDE; virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy() OVERRIDE; virtual int32_t ConnectTcp( |