Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: content/browser/appcache/chrome_appcache_service.cc

Issue 10916132: AppCache and StoragePartition'ing (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/appcache/chrome_appcache_service.h" 5 #include "content/browser/appcache/chrome_appcache_service.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "content/public/browser/content_browser_client.h" 9 #include "content/public/browser/content_browser_client.h"
10 #include "content/public/browser/resource_context.h" 10 #include "content/public/browser/resource_context.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/url_request/url_request_context_getter.h"
13 #include "webkit/appcache/appcache_storage_impl.h"
12 #include "webkit/quota/quota_manager.h" 14 #include "webkit/quota/quota_manager.h"
13 15
14 using content::BrowserThread; 16 using content::BrowserThread;
15 17
16 ChromeAppCacheService::ChromeAppCacheService( 18 ChromeAppCacheService::ChromeAppCacheService(
17 quota::QuotaManagerProxy* quota_manager_proxy) 19 quota::QuotaManagerProxy* quota_manager_proxy)
18 : AppCacheService(quota_manager_proxy), 20 : AppCacheService(quota_manager_proxy),
19 resource_context_(NULL) { 21 resource_context_(NULL) {
20 } 22 }
21 23
22 void ChromeAppCacheService::InitializeOnIOThread( 24 void ChromeAppCacheService::InitializeOnIOThread(
23 const FilePath& cache_path, 25 const FilePath& cache_path,
24 content::ResourceContext* resource_context, 26 content::ResourceContext* resource_context,
27 net::URLRequestContextGetter* request_context_getter,
25 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { 28 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) {
26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
27 30
28 cache_path_ = cache_path; 31 cache_path_ = cache_path;
29 resource_context_ = resource_context; 32 resource_context_ = resource_context;
30 set_request_context(resource_context->GetRequestContext()); 33
34 // The |request_context_getter| can be NULL in some unit tests.
35 // TODO(awong): TestProfile is difficult to work with. The
36 // SafeBrowsing tests require that GetRequestContext return NULL
37 // so we can't depend on having a non-NULL value here. See crbug/149783.
38 if (request_context_getter)
39 set_request_context(request_context_getter->GetURLRequestContext());
31 40
32 // Init our base class. 41 // Init our base class.
33 Initialize( 42 Initialize(
34 cache_path_, 43 cache_path_,
35 BrowserThread::GetMessageLoopProxyForThread( 44 BrowserThread::GetMessageLoopProxyForThread(
36 BrowserThread::FILE_USER_BLOCKING), 45 BrowserThread::FILE_USER_BLOCKING),
37 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 46 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
38 set_appcache_policy(this); 47 set_appcache_policy(this);
39 set_special_storage_policy(special_storage_policy); 48 set_special_storage_policy(special_storage_policy);
40 } 49 }
(...skipping 16 matching lines...) Expand all
57 ChromeAppCacheService::~ChromeAppCacheService() {} 66 ChromeAppCacheService::~ChromeAppCacheService() {}
58 67
59 void ChromeAppCacheService::DeleteOnCorrectThread() const { 68 void ChromeAppCacheService::DeleteOnCorrectThread() const {
60 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && 69 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
61 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { 70 !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
62 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 71 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
63 return; 72 return;
64 } 73 }
65 delete this; 74 delete this;
66 } 75 }
OLDNEW
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.h ('k') | content/browser/appcache/chrome_appcache_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698