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

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

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix memory leaks in tests Created 8 years, 10 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
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.h ('k') | content/browser/browser_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 27 matching lines...) Expand all
38 BrowserThread::GetMessageLoopProxyForThread( 38 BrowserThread::GetMessageLoopProxyForThread(
39 BrowserThread::FILE_USER_BLOCKING), 39 BrowserThread::FILE_USER_BLOCKING),
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
41 set_appcache_policy(this); 41 set_appcache_policy(this);
42 set_special_storage_policy(special_storage_policy); 42 set_special_storage_policy(special_storage_policy);
43 } 43 }
44 44
45 ChromeAppCacheService::~ChromeAppCacheService() { 45 ChromeAppCacheService::~ChromeAppCacheService() {
46 } 46 }
47 47
48 void ChromeAppCacheService::DeleteOnCorrectThread() const {
49 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
50 !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
51 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
52 return;
53 }
54 delete this;
55 }
56
48 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, 57 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url,
49 const GURL& first_party) { 58 const GURL& first_party) {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
51 // We don't prompt for read access. 60 // We don't prompt for read access.
52 return content::GetContentClient()->browser()->AllowAppCache( 61 return content::GetContentClient()->browser()->AllowAppCache(
53 manifest_url, first_party, resource_context_); 62 manifest_url, first_party, resource_context_);
54 } 63 }
55 64
56 bool ChromeAppCacheService::CanCreateAppCache( 65 bool ChromeAppCacheService::CanCreateAppCache(
57 const GURL& manifest_url, const GURL& first_party) { 66 const GURL& manifest_url, const GURL& first_party) {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
59 return content::GetContentClient()->browser()->AllowAppCache( 68 return content::GetContentClient()->browser()->AllowAppCache(
60 manifest_url, first_party, resource_context_); 69 manifest_url, first_party, resource_context_);
61 } 70 }
62 71
63 void ChromeAppCacheService::Observe( 72 void ChromeAppCacheService::Observe(
64 int type, 73 int type,
65 const content::NotificationSource& source, 74 const content::NotificationSource& source,
66 const content::NotificationDetails& details) { 75 const content::NotificationDetails& details) {
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
68 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); 77 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY);
69 PurgeMemory(); 78 PurgeMemory();
70 } 79 }
OLDNEW
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.h ('k') | content/browser/browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698