зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1753298 - Improve error handling in BaseMediaResource::ModifyLoadFlags. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D141817
This commit is contained in:
Родитель
a04b6f26a2
Коммит
682795b36e
|
@ -136,24 +136,26 @@ void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
|
|||
} else {
|
||||
loadFlags &= ~nsIRequest::LOAD_BACKGROUND;
|
||||
}
|
||||
ModifyLoadFlags(loadFlags);
|
||||
rv = ModifyLoadFlags(loadFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ModifyLoadFlags() failed!");
|
||||
}
|
||||
}
|
||||
|
||||
void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
|
||||
nsresult BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsresult rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
|
||||
|
||||
nsresult status;
|
||||
mChannel->GetStatus(&status);
|
||||
|
||||
bool inLoadGroup = false;
|
||||
if (loadGroup) {
|
||||
nsresult status;
|
||||
mChannel->GetStatus(&status);
|
||||
|
||||
rv = loadGroup->RemoveRequest(mChannel, nullptr, status);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
inLoadGroup = true;
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
inLoadGroup = true;
|
||||
}
|
||||
|
||||
rv = mChannel->SetLoadFlags(aFlags);
|
||||
|
@ -163,6 +165,8 @@ void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
|
|||
rv = loadGroup->AddRequest(mChannel, nullptr);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "AddRequest() failed!");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -127,7 +127,7 @@ class BaseMediaResource : public MediaResource,
|
|||
// Set the request's load flags to aFlags. If the request is part of a
|
||||
// load group, the request is removed from the group, the flags are set, and
|
||||
// then the request is added back to the load group.
|
||||
void ModifyLoadFlags(nsLoadFlags aFlags);
|
||||
nsresult ModifyLoadFlags(nsLoadFlags aFlags);
|
||||
|
||||
RefPtr<MediaResourceCallback> mCallback;
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ nsresult ChannelMediaResource::OnStopRequest(nsIRequest* aRequest,
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!");
|
||||
|
||||
if (loadFlags & nsIRequest::LOAD_BACKGROUND) {
|
||||
ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND);
|
||||
NS_WARN_IF(NS_FAILED(ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND)));
|
||||
}
|
||||
|
||||
// Note that aStatus might have succeeded --- this might be a normal close
|
||||
|
|
Загрузка…
Ссылка в новой задаче