Index: chrome/browser/browsing_data_file_system_helper.cc |
diff --git a/chrome/browser/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data_file_system_helper.cc |
index 5bd06f8dbc752a829dec502f30aaa070503403b9..2f4e2ed5e3e78a13753e2b2b23b39f3bd0063d0b 100644 |
--- a/chrome/browser/browsing_data_file_system_helper.cc |
+++ b/chrome/browser/browsing_data_file_system_helper.cc |
@@ -50,9 +50,9 @@ class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper { |
// the FILE thread. |
void DeleteFileSystemOriginInFileThread(const GURL& origin); |
- // We don't own the Profile object. Clients are responsible for destroying the |
- // object when it's no longer used. |
- Profile* profile_; |
+ // Keep a reference to the FileSystemContext object for the current profile |
+ // for use on the FILE thread. |
+ scoped_refptr<fileapi::FileSystemContext> filesystem_context_; |
// Holds the current list of file systems returned to the client after |
// StartFetching is called. Access to |file_system_info_| is triggered |
@@ -78,9 +78,9 @@ class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper { |
BrowsingDataFileSystemHelperImpl::BrowsingDataFileSystemHelperImpl( |
Profile* profile) |
- : profile_(profile), |
+ : filesystem_context_(BrowserContext::GetFileSystemContext(profile)), |
is_fetching_(false) { |
- DCHECK(profile_); |
+ DCHECK(filesystem_context_); |
} |
BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() { |
@@ -113,16 +113,13 @@ void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin( |
void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator> |
- origin_enumerator(BrowserContext::GetFileSystemContext(profile_)-> |
+ origin_enumerator(filesystem_context_-> |
sandbox_provider()->CreateOriginEnumerator()); |
- scoped_refptr<fileapi::FileSystemContext> context = |
- BrowserContext::GetFileSystemContext(profile_); |
- |
// We don't own this pointer; it's a magic singleton generated by the |
// profile's FileSystemContext. Deleting it would be a bad idea. |
fileapi::FileSystemQuotaUtil* quota_util = |
- context->GetQuotaUtil(fileapi::kFileSystemTypeTemporary); |
+ filesystem_context_->GetQuotaUtil(fileapi::kFileSystemTypeTemporary); |
GURL current; |
@@ -133,10 +130,10 @@ void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread() { |
// We can call these synchronous methods as we've already verified that |
// we're running on the FILE thread. |
int64 persistent_usage = quota_util->GetOriginUsageOnFileThread( |
- context, current, |
+ filesystem_context_, current, |
fileapi::kFileSystemTypePersistent); |
int64 temporary_usage = quota_util->GetOriginUsageOnFileThread( |
- context, current, |
+ filesystem_context_, current, |
fileapi::kFileSystemTypeTemporary); |
file_system_info_.push_back( |
FileSystemInfo( |
@@ -165,8 +162,7 @@ void BrowsingDataFileSystemHelperImpl::NotifyOnUIThread() { |
void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread( |
const GURL& origin) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- BrowserContext::GetFileSystemContext(profile_)-> |
- DeleteDataForOriginOnFileThread(origin); |
+ filesystem_context_->DeleteDataForOriginOnFileThread(origin); |
} |
} // namespace |