diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 19:19:23 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 19:19:23 +0000 |
commit | f9bc9c0bc9ddd0dbb989286d3abca0d740635172 (patch) | |
tree | bde968d4aba9a5ce7c07b0817350c2b841455e96 /chrome/browser/appcache | |
parent | 87924d38251e94c46ba70d57cf57d8f50a73171c (diff) | |
download | chromium_src-f9bc9c0bc9ddd0dbb989286d3abca0d740635172.zip chromium_src-f9bc9c0bc9ddd0dbb989286d3abca0d740635172.tar.gz chromium_src-f9bc9c0bc9ddd0dbb989286d3abca0d740635172.tar.bz2 |
Browser process scaffolding to support having appcache work in workers.
* Associate a RequestContext with a WorkerProcessHost. This corresponds to themain request context of the profile for which the worker process is running. Also associate the context with each WorkerInstance which comes into existance priorto the WorkerProcessHost that will host the instance.
* Give the WorkerProcessHost an AppCacheDispatcherHost.
* Fix up some recently botched IPC plumbing for ViewHostMsg_CreateWorker_Params.
BUG=39368
TEST=there are no worker unit tests
Review URL: http://codereview.chromium.org/2010010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/appcache')
-rw-r--r-- | chrome/browser/appcache/appcache_dispatcher_host.cc | 18 | ||||
-rw-r--r-- | chrome/browser/appcache/appcache_dispatcher_host.h | 7 |
2 files changed, 21 insertions, 4 deletions
diff --git a/chrome/browser/appcache/appcache_dispatcher_host.cc b/chrome/browser/appcache/appcache_dispatcher_host.cc index ee4ba3a..2ef6fca 100644 --- a/chrome/browser/appcache/appcache_dispatcher_host.cc +++ b/chrome/browser/appcache/appcache_dispatcher_host.cc @@ -11,9 +11,16 @@ #include "chrome/common/render_messages.h" AppCacheDispatcherHost::AppCacheDispatcherHost( + URLRequestContext* request_context) + : request_context_(request_context), + process_handle_(0) { + DCHECK(request_context_.get()); +} + +AppCacheDispatcherHost::AppCacheDispatcherHost( URLRequestContextGetter* request_context_getter) - : request_context_getter_(request_context_getter), - process_handle_(0) { + : request_context_getter_(request_context_getter), + process_handle_(0) { DCHECK(request_context_getter_.get()); } @@ -21,14 +28,17 @@ void AppCacheDispatcherHost::Initialize(IPC::Message::Sender* sender, int process_id, base::ProcessHandle process_handle) { DCHECK(sender); DCHECK(process_handle && !process_handle_); - DCHECK(request_context_getter_.get()); + DCHECK(request_context_.get() || request_context_getter_.get()); process_handle_ = process_handle; // Get the AppCacheService (it can only be accessed from IO thread). - URLRequestContext* context = request_context_getter_->GetURLRequestContext(); + URLRequestContext* context = request_context_.get(); + if (!context) + context = request_context_getter_->GetURLRequestContext(); appcache_service_ = static_cast<ChromeURLRequestContext*>(context)->appcache_service(); + request_context_ = NULL; request_context_getter_ = NULL; frontend_proxy_.set_sender(sender); diff --git a/chrome/browser/appcache/appcache_dispatcher_host.h b/chrome/browser/appcache/appcache_dispatcher_host.h index ea2fe93..c4831a4 100644 --- a/chrome/browser/appcache/appcache_dispatcher_host.h +++ b/chrome/browser/appcache/appcache_dispatcher_host.h @@ -15,6 +15,7 @@ #include "webkit/appcache/appcache_backend_impl.h" class ChromeAppCacheService; +class URLRequestContext; class URLRequestContextGetter; // Handles appcache related messages sent to the main browser process from @@ -23,6 +24,11 @@ class URLRequestContextGetter; // an instance and delegates calls to it. class AppCacheDispatcherHost { public: + // Constructor for use on the IO thread. + explicit AppCacheDispatcherHost( + URLRequestContext* request_context); + + // Constructor for use on the UI thread. explicit AppCacheDispatcherHost( URLRequestContextGetter* request_context_getter); @@ -61,6 +67,7 @@ class AppCacheDispatcherHost { // Temporary until Initialize() can be called from the IO thread, // which will extract the AppCacheService from the URLRequestContext. + scoped_refptr<URLRequestContext> request_context_; scoped_refptr<URLRequestContextGetter> request_context_getter_; // This is only valid once Initialize() has been called. |