fix: allow blocking IO for setAppLogsPath to avoid DCHECK (#23111)
* fix: let setAppLogsPath write to disk on UI thread Otherwise, the DCHECK in thread_restrictions will fire. * scope the io allowance more tightly * oops, scope it tightly in the mac version too
This commit is contained in:
parent
07654c47ec
commit
cd0dda0125
2 changed files with 17 additions and 6 deletions
|
@ -21,7 +21,10 @@ void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
|||
thrower.ThrowError("Path must be absolute");
|
||||
return;
|
||||
}
|
||||
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
|
||||
{
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
|
||||
}
|
||||
} else {
|
||||
NSString* bundle_name =
|
||||
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
|
||||
|
@ -29,8 +32,11 @@ void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
|||
[NSString stringWithFormat:@"Library/Logs/%@", bundle_name];
|
||||
NSString* library_path =
|
||||
[NSHomeDirectory() stringByAppendingPathComponent:logs_path];
|
||||
base::PathService::Override(DIR_APP_LOGS,
|
||||
base::FilePath([library_path UTF8String]));
|
||||
{
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
base::PathService::Override(DIR_APP_LOGS,
|
||||
base::FilePath([library_path UTF8String]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue