diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 23:24:38 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 23:24:38 +0000 |
commit | bd1523876a769c375e0a40b8cfe8c999f40e6e99 (patch) | |
tree | 2a2f91b4feee685386936f897f84a41d99d8e721 /chrome/browser/file_system | |
parent | e7dd6d8bb28270d49684714aa03f8162ab558bc6 (diff) | |
download | chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.zip chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.tar.gz chromium_src-bd1523876a769c375e0a40b8cfe8c999f40e6e99.tar.bz2 |
Resubmit of http://codereview.chromium.org/3476002/show but without the crashing bug.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3618016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/file_system')
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.cc | 14 | ||||
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.h | 11 |
2 files changed, 21 insertions, 4 deletions
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc index 177c98d..b2e9cb6 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.cc +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc @@ -13,9 +13,11 @@ #include "chrome/browser/file_system/file_system_host_context.h" #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" +#include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "googleurl/src/gurl.h" +#include "net/url_request/url_request_context.h" // A class to hold an ongoing openFileSystem completion task. struct OpenFileSystemCompletionTask { @@ -69,12 +71,14 @@ struct OpenFileSystemCompletionTask { FileSystemDispatcherHost::FileSystemDispatcherHost( IPC::Message::Sender* sender, FileSystemHostContext* file_system_host_context, - HostContentSettingsMap* host_content_settings_map) + HostContentSettingsMap* host_content_settings_map, + URLRequestContextGetter* request_context_getter) : message_sender_(sender), process_handle_(0), shutdown_(false), context_(file_system_host_context), - host_content_settings_map_(host_content_settings_map) { + host_content_settings_map_(host_content_settings_map), + request_context_getter_(request_context_getter) { DCHECK(message_sender_); } @@ -87,6 +91,9 @@ void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) { DCHECK(!process_handle_); DCHECK(process_handle); process_handle_ = process_handle; + DCHECK(!request_context_.get()); + if (request_context_getter_.get()) + request_context_ = request_context_getter_->GetURLRequestContext(); } void FileSystemDispatcherHost::Shutdown() { @@ -214,7 +221,8 @@ void FileSystemDispatcherHost::OnWrite( int64 offset) { if (!CheckValidFileSystemPath(path, request_id)) return; - GetNewOperation(request_id)->Write(path, blob_url, offset); + GetNewOperation(request_id)->Write( + request_context_, path, blob_url, offset); } void FileSystemDispatcherHost::OnTruncate( diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h index 68110be..201ade6 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.h +++ b/chrome/browser/file_system/file_system_dispatcher_host.h @@ -26,13 +26,17 @@ class GURL; class HostContentSettingsMap; class Receiver; class ResourceMessageFilter; +class URLRequestContextGetter; class FileSystemDispatcherHost : public base::RefCountedThreadSafe<FileSystemDispatcherHost> { public: + // TODO(ericu): Split this into two constructors when adding worker FileWriter + // support. FileSystemDispatcherHost(IPC::Message::Sender* sender, FileSystemHostContext* file_system_host_context, - HostContentSettingsMap* host_content_settings_map); + HostContentSettingsMap* host_content_settings_map, + URLRequestContextGetter* url_request_context_getter); ~FileSystemDispatcherHost(); void Init(base::ProcessHandle process_handle); void Shutdown(); @@ -97,6 +101,11 @@ class FileSystemDispatcherHost typedef IDMap<fileapi::FileSystemOperation, IDMapOwnPointer> OperationsMap; OperationsMap operations_; + // This holds the URLRequestContextGetter until Init() can be called from the + // IO thread, which will extract the URLRequestContext from it. + scoped_refptr<URLRequestContextGetter> request_context_getter_; + scoped_refptr<URLRequestContext> request_context_; + DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); }; |