diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-04 21:16:19 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-04 21:16:19 +0000 |
commit | f49c0bb7c10c7905812c71ff849b25d00d681ce1 (patch) | |
tree | 84378b79f60a432c8d87f80e6751f1dd5ddcc65d /content/browser/appcache | |
parent | 6c5b9b59bd5be7652134bda94dc75ef505adc1b1 (diff) | |
download | chromium_src-f49c0bb7c10c7905812c71ff849b25d00d681ce1.zip chromium_src-f49c0bb7c10c7905812c71ff849b25d00d681ce1.tar.gz chromium_src-f49c0bb7c10c7905812c71ff849b25d00d681ce1.tar.bz2 |
Fix an AppCache crash due to a dangling ResourceContext ptr.
- add GetAppCacheService() to the content::BrowserContext interface
- no longer depend on ResourceContext to retrieve the AppCacheService reference in AppCacheDispatcherHost
Also treat the FileSystemContext / FileSytemDispatcherHost in the same way.
BUG=95118
Review URL: http://codereview.chromium.org/7832012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/appcache')
-rw-r--r-- | content/browser/appcache/appcache_dispatcher_host.cc | 13 | ||||
-rw-r--r-- | content/browser/appcache/appcache_dispatcher_host.h | 14 |
2 files changed, 5 insertions, 22 deletions
diff --git a/content/browser/appcache/appcache_dispatcher_host.cc b/content/browser/appcache/appcache_dispatcher_host.cc index b52d62e..3f2447a 100644 --- a/content/browser/appcache/appcache_dispatcher_host.cc +++ b/content/browser/appcache/appcache_dispatcher_host.cc @@ -6,28 +6,21 @@ #include "base/callback.h" #include "content/browser/appcache/chrome_appcache_service.h" -#include "content/browser/resource_context.h" #include "content/browser/user_metrics.h" #include "content/common/appcache_messages.h" AppCacheDispatcherHost::AppCacheDispatcherHost( - const content::ResourceContext* resource_context, + ChromeAppCacheService* appcache_service, int process_id) - : ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)), - resource_context_(resource_context), + : appcache_service_(appcache_service), + ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)), process_id_(process_id) { - DCHECK(resource_context_); } AppCacheDispatcherHost::~AppCacheDispatcherHost() {} void AppCacheDispatcherHost::OnChannelConnected(int32 peer_pid) { BrowserMessageFilter::OnChannelConnected(peer_pid); - - // Get the AppCacheService (it can only be accessed from IO thread). - appcache_service_ = resource_context_->appcache_service(); - resource_context_ = NULL; - if (appcache_service_.get()) { backend_impl_.Initialize( appcache_service_.get(), &frontend_proxy_, process_id_); diff --git a/content/browser/appcache/appcache_dispatcher_host.h b/content/browser/appcache/appcache_dispatcher_host.h index ef5e891..a2fe1fc 100644 --- a/content/browser/appcache/appcache_dispatcher_host.h +++ b/content/browser/appcache/appcache_dispatcher_host.h @@ -17,9 +17,6 @@ #include "webkit/appcache/appcache_backend_impl.h" class ChromeAppCacheService; -namespace content { -class ResourceContext; -} // namespace content // Handles appcache related messages sent to the main browser process from // its child processes. There is a distinct host for each child process. @@ -27,7 +24,7 @@ class ResourceContext; // WorkerProcessHost create an instance and delegates calls to it. class AppCacheDispatcherHost : public BrowserMessageFilter { public: - AppCacheDispatcherHost(const content::ResourceContext* resource_context, + AppCacheDispatcherHost(ChromeAppCacheService* appcache_service, int process_id); virtual ~AppCacheDispatcherHost(); @@ -62,18 +59,11 @@ class AppCacheDispatcherHost : public BrowserMessageFilter { void StartUpdateCallback(bool result, void* param); void SwapCacheCallback(bool result, void* param); - // This is only valid once Initialize() has been called. This MUST be defined - // before backend_impl_ since the latter maintains a (non-refcounted) pointer - // to it. - scoped_refptr<ChromeAppCacheService> appcache_service_; + scoped_refptr<ChromeAppCacheService> appcache_service_; AppCacheFrontendProxy frontend_proxy_; appcache::AppCacheBackendImpl backend_impl_; - // Temporary until OnChannelConnected() can be called from the IO thread, - // which will extract the AppCacheService from the net::URLRequestContext. - const content::ResourceContext* resource_context_; - scoped_ptr<appcache::GetStatusCallback> get_status_callback_; scoped_ptr<appcache::StartUpdateCallback> start_update_callback_; scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; |