mirror of
https://github.com/electron/electron.git
synced 2026-02-10 07:05:35 -05:00
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:
@@ -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 {
|
||||
|
||||
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user