Bug 1029552 - Release HW resource when the MediaElement UnbindFromTree. r=cpearce

This commit is contained in:
Benjamin Chen 2014-10-13 12:07:42 +08:00
Родитель d51cf05539
Коммит e982cacdd4
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -2520,6 +2520,9 @@ nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParen
// It's value may have changed, so update it. // It's value may have changed, so update it.
UpdatePreloadAction(); UpdatePreloadAction();
} }
if (mDecoder) {
mDecoder->SetDormantIfNecessary(false);
}
return rv; return rv;
} }
@ -2529,6 +2532,11 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
{ {
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY)
Pause(); Pause();
if (mDecoder) {
mDecoder->SetDormantIfNecessary(true);
}
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
} }