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

Unified Diff: chrome/browser/browsing_data_file_system_helper.cc

Issue 10764015: Ensure static BrowserContext methods only get called on the UI thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix unittests Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browsing_data_file_system_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_file_system_helper.cc
===================================================================
--- chrome/browser/browsing_data_file_system_helper.cc (revision 145676)
+++ chrome/browser/browsing_data_file_system_helper.cc (working copy)
@@ -50,9 +50,9 @@
// 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 @@
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::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 @@
// 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::DeleteFileSystemOriginInFileThread(
const GURL& origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- BrowserContext::GetFileSystemContext(profile_)->
- DeleteDataForOriginOnFileThread(origin);
+ filesystem_context_->DeleteDataForOriginOnFileThread(origin);
}
} // namespace
« no previous file with comments | « no previous file | chrome/browser/browsing_data_file_system_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698