OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/resource_context_impl.h" | 5 #include "content/browser/resource_context_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/appcache/chrome_appcache_service.h" | 8 #include "content/browser/appcache/chrome_appcache_service.h" |
9 #include "content/browser/fileapi/browser_file_system_helper.h" | 9 #include "content/browser/fileapi/browser_file_system_helper.h" |
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // TODO(jam): Add the ProtocolHandlerRegistryIntercepter here! | 173 // TODO(jam): Add the ProtocolHandlerRegistryIntercepter here! |
174 } | 174 } |
175 | 175 |
176 } // namespace | 176 } // namespace |
177 | 177 |
178 AppCacheService* ResourceContext::GetAppCacheService(ResourceContext* context) { | 178 AppCacheService* ResourceContext::GetAppCacheService(ResourceContext* context) { |
179 return UserDataAdapter<ChromeAppCacheService>::Get( | 179 return UserDataAdapter<ChromeAppCacheService>::Get( |
180 context, kAppCacheServicKeyName); | 180 context, kAppCacheServicKeyName); |
181 } | 181 } |
182 | 182 |
| 183 ResourceContext::ResourceContext() { |
| 184 if (ResourceDispatcherHostImpl::Get()) |
| 185 ResourceDispatcherHostImpl::Get()->AddResourceContext(this); |
| 186 } |
| 187 |
183 ResourceContext::~ResourceContext() { | 188 ResourceContext::~ResourceContext() { |
184 if (ResourceDispatcherHostImpl::Get()) | 189 ResourceDispatcherHostImpl* rdhi = ResourceDispatcherHostImpl::Get(); |
185 ResourceDispatcherHostImpl::Get()->CancelRequestsForContext(this); | 190 if (rdhi) { |
| 191 rdhi->CancelRequestsForContext(this); |
| 192 rdhi->RemoveResourceContext(this); |
| 193 } |
186 } | 194 } |
187 | 195 |
188 BlobStorageController* GetBlobStorageControllerForResourceContext( | 196 BlobStorageController* GetBlobStorageControllerForResourceContext( |
189 ResourceContext* resource_context) { | 197 ResourceContext* resource_context) { |
190 return GetChromeBlobStorageContextForResourceContext(resource_context)-> | 198 return GetChromeBlobStorageContextForResourceContext(resource_context)-> |
191 controller(); | 199 controller(); |
192 } | 200 } |
193 | 201 |
194 DatabaseTracker* GetDatabaseTrackerForResourceContext( | 202 DatabaseTracker* GetDatabaseTrackerForResourceContext( |
195 ResourceContext* resource_context) { | 203 ResourceContext* resource_context) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 BrowserThread::PostTask( | 273 BrowserThread::PostTask( |
266 BrowserThread::IO, FROM_HERE, | 274 BrowserThread::IO, FROM_HERE, |
267 base::Bind(&InitializeRequestContext, | 275 base::Bind(&InitializeRequestContext, |
268 resource_context, | 276 resource_context, |
269 make_scoped_refptr( | 277 make_scoped_refptr( |
270 browser_context->GetRequestContextForMedia()))); | 278 browser_context->GetRequestContextForMedia()))); |
271 } | 279 } |
272 } | 280 } |
273 | 281 |
274 } // namespace content | 282 } // namespace content |
OLD | NEW |