Fix debug assertion about performing IO on the UI thread

We were querying the application's FILEVERSIONINFO every time we needed to
figure out the path for storing BrowserContext data. Now we cache the path the
first time we need it, which is during application initialization and before IO
prohibitions begin.
This commit is contained in:
Adam Roben 2013-06-04 14:17:16 -04:00
parent 14edfc7f7c
commit 4c9870e753
2 changed files with 6 additions and 1 deletions

View file

@ -72,9 +72,13 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::Prot
}
base::FilePath BrowserContext::GetPath() {
if (!path_.empty())
return path_;
base::FilePath path;
CHECK(PathService::Get(base::DIR_APP_DATA, &path));
return path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
return path_;
}
bool BrowserContext::IsOffTheRecord() const {

View file

@ -46,6 +46,7 @@ private:
virtual content::SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
base::FilePath path_;
scoped_ptr<ResourceContext> resource_context_;
scoped_refptr<URLRequestContextGetter> url_request_getter_;
scoped_ptr<PrefService> prefs_;