Bug 1857153 - Only create qlog folder in parent process, r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D190149
This commit is contained in:
Kershaw Chang 2023-10-05 19:48:31 +00:00
Родитель c5999e857d
Коммит f40f7742bd
1 изменённых файлов: 23 добавлений и 19 удалений

Просмотреть файл

@ -337,27 +337,31 @@ nsresult nsHttpHandler::Init() {
Telemetry::ScalarSet(Telemetry::ScalarID::NETWORKING_HTTPS_RR_PREFS_USAGE,
static_cast<uint32_t>(usageOfHTTPSRRPrefs.to_ulong()));
mActivityDistributor = components::HttpActivityDistributor::Service();
auto initQLogDir = [&]() {
if (!StaticPrefs::network_http_http3_enable_qlog()) {
return EmptyCString();
}
nsCOMPtr<nsIFile> qlogDir;
nsresult rv =
NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(qlogDir));
if (NS_WARN_IF(NS_FAILED(rv))) {
return EmptyCString();
}
nsAutoCString dirName("qlog_");
dirName.AppendInt(mProcessId);
rv = qlogDir->AppendNative(dirName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return EmptyCString();
}
return qlogDir->HumanReadablePath();
};
mHttp3QlogDir = initQLogDir();
}
auto initQLogDir = [&]() {
nsCOMPtr<nsIFile> qlogDir;
nsresult rv =
NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(qlogDir));
if (NS_WARN_IF(NS_FAILED(rv))) {
return EmptyCString();
}
nsAutoCString dirName("qlog_");
dirName.AppendInt(mProcessId);
rv = qlogDir->AppendNative(dirName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return EmptyCString();
}
return qlogDir->HumanReadablePath();
};
mHttp3QlogDir = initQLogDir();
// monitor some preference changes
Preferences::RegisterPrefixCallbacks(nsHttpHandler::PrefsChanged,
gCallbackPrefs, this);