summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 20:20:29 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 20:20:29 +0000
commita9cbca53ec29281e9ca05d8418a7686a12664334 (patch)
tree2cf4a0b37dd91984a8ba21655ef5ed8dce39e6cb
parentaa87edec590fca9920265198b1c77b93a20c043d (diff)
downloadchromium_src-a9cbca53ec29281e9ca05d8418a7686a12664334.zip
chromium_src-a9cbca53ec29281e9ca05d8418a7686a12664334.tar.gz
chromium_src-a9cbca53ec29281e9ca05d8418a7686a12664334.tar.bz2
Initial work on worker support for FileWriter.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3650002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62181 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/file_system/file_system_dispatcher_host.cc30
-rw-r--r--chrome/browser/file_system/file_system_dispatcher_host.h12
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc5
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc5
4 files changed, 30 insertions, 22 deletions
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc
index d7af9ea..df77a57 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.cc
+++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
@@ -12,6 +12,8 @@
#include "chrome/browser/file_system/browser_file_system_callback_dispatcher.h"
#include "chrome/browser/file_system/file_system_host_context.h"
#include "chrome/browser/host_content_settings_map.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/profile.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"
@@ -72,16 +74,24 @@ struct OpenFileSystemCompletionTask {
};
FileSystemDispatcherHost::FileSystemDispatcherHost(
- IPC::Message::Sender* sender,
- FileSystemHostContext* file_system_host_context,
- HostContentSettingsMap* host_content_settings_map,
- URLRequestContextGetter* request_context_getter)
+ IPC::Message::Sender* sender, Profile* profile)
: message_sender_(sender),
process_handle_(0),
shutdown_(false),
- context_(file_system_host_context),
- host_content_settings_map_(host_content_settings_map),
- request_context_getter_(request_context_getter) {
+ context_(profile->GetFileSystemHostContext()),
+ host_content_settings_map_(profile->GetHostContentSettingsMap()),
+ request_context_getter_(profile->GetRequestContext()) {
+ DCHECK(message_sender_);
+}
+
+FileSystemDispatcherHost::FileSystemDispatcherHost(
+ IPC::Message::Sender* sender, ChromeURLRequestContext* context)
+ : message_sender_(sender),
+ process_handle_(0),
+ shutdown_(false),
+ context_(context->file_system_host_context()),
+ host_content_settings_map_(context->host_content_settings_map()),
+ request_context_(context) {
DCHECK(message_sender_);
}
@@ -94,9 +104,11 @@ 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())
+ if (request_context_getter_.get()) {
+ DCHECK(!request_context_.get());
request_context_ = request_context_getter_->GetURLRequestContext();
+ }
+ DCHECK(request_context_.get());
}
void FileSystemDispatcherHost::Shutdown() {
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h
index 9387ba8..cbe86aa 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.h
+++ b/chrome/browser/file_system/file_system_dispatcher_host.h
@@ -21,9 +21,11 @@ namespace base {
class Time;
}
+class ChromeURLRequestContext;
class FileSystemHostContext;
class GURL;
class HostContentSettingsMap;
+class Profile;
class Receiver;
class ResourceMessageFilter;
class URLRequestContextGetter;
@@ -31,12 +33,12 @@ class URLRequestContextGetter;
class FileSystemDispatcherHost
: public base::RefCountedThreadSafe<FileSystemDispatcherHost> {
public:
- // TODO(ericu): Split this into two constructors when adding worker FileWriter
- // support.
+ // Used by the renderer.
FileSystemDispatcherHost(IPC::Message::Sender* sender,
- FileSystemHostContext* file_system_host_context,
- HostContentSettingsMap* host_content_settings_map,
- URLRequestContextGetter* url_request_context_getter);
+ Profile* profile);
+ // Used by the worker, since it has the context handy already.
+ FileSystemDispatcherHost(IPC::Message::Sender* sender,
+ ChromeURLRequestContext* context);
~FileSystemDispatcherHost();
void Init(base::ProcessHandle process_handle);
void Shutdown();
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index e28bf95..1c5e569 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -255,10 +255,7 @@ ResourceMessageFilter::ResourceMessageFilter(
ALLOW_THIS_IN_INITIALIZER_LIST(device_orientation_dispatcher_host_(
new device_orientation::DispatcherHost(this->id()))),
ALLOW_THIS_IN_INITIALIZER_LIST(file_system_dispatcher_host_(
- new FileSystemDispatcherHost(this,
- profile->GetFileSystemHostContext(),
- profile->GetHostContentSettingsMap(),
- profile->GetRequestContext()))),
+ new FileSystemDispatcherHost(this, profile))),
ALLOW_THIS_IN_INITIALIZER_LIST(blob_dispatcher_host_(
new BlobDispatcherHost(
this->id(), profile->GetBlobStorageContext()))) {
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index 12dfe2d..49e919a 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -70,10 +70,7 @@ WorkerProcessHost::WorkerProcessHost(
new BlobDispatcherHost(
this->id(), request_context->blob_storage_context()))),
ALLOW_THIS_IN_INITIALIZER_LIST(file_system_dispatcher_host_(
- new FileSystemDispatcherHost(this,
- request_context->file_system_host_context(),
- request_context->host_content_settings_map(),
- NULL /* TODO(ericu)*/))) {
+ new FileSystemDispatcherHost(this, request_context))) {
next_route_id_callback_.reset(NewCallbackWithReturnValue(
WorkerService::GetInstance(), &WorkerService::next_worker_route_id));
db_dispatcher_host_ = new DatabaseDispatcherHost(