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:
parent
14edfc7f7c
commit
4c9870e753
2 changed files with 6 additions and 1 deletions
|
@ -72,9 +72,13 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::Prot
|
||||||
}
|
}
|
||||||
|
|
||||||
base::FilePath BrowserContext::GetPath() {
|
base::FilePath BrowserContext::GetPath() {
|
||||||
|
if (!path_.empty())
|
||||||
|
return path_;
|
||||||
|
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
CHECK(PathService::Get(base::DIR_APP_DATA, &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 {
|
bool BrowserContext::IsOffTheRecord() const {
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
virtual content::SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() OVERRIDE;
|
virtual content::SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() OVERRIDE;
|
||||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||||
|
|
||||||
|
base::FilePath path_;
|
||||||
scoped_ptr<ResourceContext> resource_context_;
|
scoped_ptr<ResourceContext> resource_context_;
|
||||||
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
||||||
scoped_ptr<PrefService> prefs_;
|
scoped_ptr<PrefService> prefs_;
|
||||||
|
|
Loading…
Reference in a new issue