diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 17:00:42 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 17:00:42 +0000 |
commit | 9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8 (patch) | |
tree | b9991ef261fb6107a25947da1231c36e70919bd1 /chrome/browser/file_system | |
parent | dc8caba097e35e536697f3bf6605257317640d26 (diff) | |
download | chromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.zip chromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.tar.gz chromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.tar.bz2 |
Switch a bunch of remaining filters to derive from BrowserMessageFilters so that ResourceMessageFilter doesn't have to know about them and vice versa. A bunch of small cleanup in the process. I've added new message files for classes that want their messages dispatched on threads other than the IO.
Review URL: http://codereview.chromium.org/5698008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/file_system')
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.cc | 41 | ||||
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.h | 30 |
2 files changed, 16 insertions, 55 deletions
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc index 64b4801..fe2504d 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.cc +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc @@ -10,7 +10,6 @@ #include "base/file_path.h" #include "base/thread.h" #include "base/time.h" -#include "chrome/browser/browser_thread.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/file_system/browser_file_system_context.h" #include "chrome/browser/net/chrome_url_request_context.h" @@ -82,37 +81,25 @@ class BrowserFileSystemCallbackDispatcher int request_id_; }; -FileSystemDispatcherHost::FileSystemDispatcherHost( - IPC::Message::Sender* sender, Profile* profile) - : message_sender_(sender), - process_handle_(0), - shutdown_(false), - context_(profile->GetFileSystemContext()), +FileSystemDispatcherHost::FileSystemDispatcherHost(Profile* profile) + : context_(profile->GetFileSystemContext()), 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->browser_file_system_context()), + ChromeURLRequestContext* context) + : context_(context->browser_file_system_context()), host_content_settings_map_(context->host_content_settings_map()), request_context_(context) { - DCHECK(message_sender_); } FileSystemDispatcherHost::~FileSystemDispatcherHost() { } -void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(!shutdown_); - DCHECK(!process_handle_); - DCHECK(process_handle); - process_handle_ = process_handle; +void FileSystemDispatcherHost::OnChannelConnected(int32 peer_pid) { + BrowserMessageFilter::OnChannelConnected(peer_pid); + if (request_context_getter_.get()) { DCHECK(!request_context_.get()); request_context_ = request_context_getter_->GetURLRequestContext(); @@ -120,14 +107,8 @@ void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) { DCHECK(request_context_.get()); } -void FileSystemDispatcherHost::Shutdown() { - message_sender_ = NULL; - shutdown_ = true; -} - bool FileSystemDispatcherHost::OnMessageReceived( const IPC::Message& message, bool* message_was_ok) { - DCHECK(!shutdown_); *message_was_ok = true; bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok) @@ -251,14 +232,6 @@ void FileSystemDispatcherHost::OnCancel( } } -void FileSystemDispatcherHost::Send(IPC::Message* message) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (!shutdown_ && message_sender_) - message_sender_->Send(message); - else - delete message; -} - SandboxedFileSystemOperation* FileSystemDispatcherHost::GetNewOperation( int request_id) { BrowserFileSystemCallbackDispatcher* dispatcher = diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h index fdbe8f6..b7f50ed 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.h +++ b/chrome/browser/file_system/file_system_dispatcher_host.h @@ -9,9 +9,7 @@ #include "base/basictypes.h" #include "base/id_map.h" -#include "base/process.h" -#include "base/ref_counted.h" -#include "ipc/ipc_message.h" +#include "chrome/browser/browser_message_filter.h" #include "webkit/fileapi/file_system_types.h" namespace base { @@ -33,20 +31,19 @@ namespace fileapi { class SandboxedFileSystemOperation; } -class FileSystemDispatcherHost - : public base::RefCountedThreadSafe<FileSystemDispatcherHost> { +class FileSystemDispatcherHost : public BrowserMessageFilter { public: // Used by the renderer. - FileSystemDispatcherHost(IPC::Message::Sender* sender, - Profile* profile); + explicit FileSystemDispatcherHost(Profile* profile); // Used by the worker, since it has the context handy already. - FileSystemDispatcherHost(IPC::Message::Sender* sender, - ChromeURLRequestContext* context); + explicit FileSystemDispatcherHost(ChromeURLRequestContext* context); ~FileSystemDispatcherHost(); - void Init(base::ProcessHandle process_handle); - void Shutdown(); - bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok); + // BrowserMessageFilter implementation. + virtual void OnChannelConnected(int32 peer_pid); + virtual bool OnMessageReceived(const IPC::Message& message, + bool* message_was_ok); + void OnOpenFileSystem(int request_id, const GURL& origin_url, @@ -78,21 +75,12 @@ class FileSystemDispatcherHost const base::Time& last_access_time, const base::Time& last_modified_time); void OnCancel(int request_id, int request_to_cancel); - void Send(IPC::Message* message); void UnregisterOperation(int request_id); private: // Creates a new SandboxedFileSystemOperation. fileapi::SandboxedFileSystemOperation* GetNewOperation(int request_id); - // The sender to be used for sending out IPC messages. - IPC::Message::Sender* message_sender_; - - // The handle of this process. - base::ProcessHandle process_handle_; - - bool shutdown_; - scoped_refptr<BrowserFileSystemContext> context_; // Used to look up permissions. |