зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d04e34978e0b (bug 1605072) for test crashes e.g [@ mozilla::PreallocatedProcessManagerImpl::AddBlocker(mozilla::dom::ContentParent*)] on a CLOSED TREE
This commit is contained in:
Родитель
4f6a8429cf
Коммит
d4787eba7e
|
@ -274,6 +274,26 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI,
|
|||
LoadURI(nullptr, loadState, true);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
using NewOrUsedPromise = MozPromise<RefPtr<ContentParent>, nsresult, false>;
|
||||
|
||||
// NOTE: This method is currently a dummy, and always actually spawns sync. It
|
||||
// mostly exists so I can test out the async API right now.
|
||||
RefPtr<NewOrUsedPromise> GetNewOrUsedBrowserProcessAsync(
|
||||
const nsAString& aRemoteType) {
|
||||
RefPtr<ContentParent> contentParent =
|
||||
ContentParent::GetNewOrUsedBrowserProcess(
|
||||
nullptr, aRemoteType, hal::PROCESS_PRIORITY_FOREGROUND, nullptr,
|
||||
false);
|
||||
if (!contentParent) {
|
||||
return NewOrUsedPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
return NewOrUsedPromise::CreateAndResolve(contentParent, __func__);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void CanonicalBrowsingContext::PendingRemotenessChange::Complete(
|
||||
ContentParent* aContentParent) {
|
||||
if (!mPromise) {
|
||||
|
@ -491,18 +511,13 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType,
|
|||
new PendingRemotenessChange(this, promise, aPendingSwitchId);
|
||||
mPendingRemotenessChange = change;
|
||||
|
||||
ContentParent::GetNewOrUsedBrowserProcessAsync(
|
||||
/* aFrameElement = */ nullptr,
|
||||
/* aRemoteType = */ aRemoteType,
|
||||
/* aPriority = */ hal::PROCESS_PRIORITY_FOREGROUND,
|
||||
/* aOpener = */ nullptr,
|
||||
/* aPreferUsed = */ false)
|
||||
GetNewOrUsedBrowserProcessAsync(aRemoteType)
|
||||
->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[change](ContentParent* aContentParent) {
|
||||
change->Complete(aContentParent);
|
||||
},
|
||||
[change](LaunchError aError) { change->Cancel(NS_ERROR_FAILURE); });
|
||||
[change](nsresult aRv) { change->Cancel(aRv); });
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче