Bug 1373888 - part6 : only release the wakelock when video is paused. r=cpearce
Wakelock would automatically handle the lock/unlock by listening "hidden/visible", we don't need to handle it in HTMLVideoElement. MozReview-Commit-ID: AcOwR2nqm6L
This commit is contained in:
@@ -235,13 +235,6 @@ HTMLVideoElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
return HTMLVideoElementBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLVideoElement::NotifyOwnerDocumentActivityChanged()
|
||||
{
|
||||
HTMLMediaElement::NotifyOwnerDocumentActivityChanged();
|
||||
UpdateScreenWakeLock();
|
||||
}
|
||||
|
||||
FrameStatistics*
|
||||
HTMLVideoElement::GetFrameStatistics()
|
||||
{
|
||||
@@ -318,9 +311,7 @@ HTMLVideoElement::WakeLockRelease()
|
||||
void
|
||||
HTMLVideoElement::UpdateScreenWakeLock()
|
||||
{
|
||||
bool hidden = OwnerDoc()->Hidden();
|
||||
|
||||
if (mScreenWakeLock && (mPaused || hidden)) {
|
||||
if (mScreenWakeLock && mPaused) {
|
||||
ErrorResult rv;
|
||||
mScreenWakeLock->Unlock(rv);
|
||||
rv.SuppressException();
|
||||
@@ -328,7 +319,7 @@ HTMLVideoElement::UpdateScreenWakeLock()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mScreenWakeLock && !mPaused && !hidden && HasVideo()) {
|
||||
if (!mScreenWakeLock && !mPaused && HasVideo()) {
|
||||
RefPtr<power::PowerManagerService> pmService =
|
||||
power::PowerManagerService::GetInstance();
|
||||
NS_ENSURE_TRUE_VOID(pmService);
|
||||
|
||||
Reference in New Issue
Block a user