Bug 1641496 - P5: Make nsHttpActivityDistributor::AddObserver work if socket process is not ready r=dragana

Differential Revision: https://phabricator.services.mozilla.com/D77276
This commit is contained in:
Kershaw Chang 2020-06-04 11:49:40 +00:00
Родитель fb7f2879f7
Коммит 57cbc05cf3
1 изменённых файлов: 14 добавлений и 12 удалений

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

@ -152,12 +152,13 @@ nsHttpActivityDistributor::AddObserver(nsIHttpActivityObserver* aObserver) {
}
if (nsIOService::UseSocketProcess() && wasEmpty) {
SocketProcessParent* parent = SocketProcessParent::GetSingleton();
if (parent && parent->CanSend()) {
Unused << parent->SendOnHttpActivityDistributorActivated(true);
} else {
return NS_ERROR_FAILURE;
}
auto task = []() {
SocketProcessParent* parent = SocketProcessParent::GetSingleton();
if (parent && parent->CanSend()) {
Unused << parent->SendOnHttpActivityDistributorActivated(true);
}
};
gIOService->CallOrWaitForSocketProcess(task);
}
return NS_OK;
}
@ -177,12 +178,13 @@ nsHttpActivityDistributor::RemoveObserver(nsIHttpActivityObserver* aObserver) {
}
if (nsIOService::UseSocketProcess() && isEmpty) {
SocketProcessParent* parent = SocketProcessParent::GetSingleton();
if (parent && parent->CanSend()) {
Unused << parent->SendOnHttpActivityDistributorActivated(false);
} else {
return NS_ERROR_FAILURE;
}
auto task = []() {
SocketProcessParent* parent = SocketProcessParent::GetSingleton();
if (parent && parent->CanSend()) {
Unused << parent->SendOnHttpActivityDistributorActivated(false);
}
};
gIOService->CallOrWaitForSocketProcess(task);
}
return NS_OK;
}