mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1113086 - AudioChannel policy in Browser API - patch 3 - right management of audiochannel-activity events in child processes, r=ehsan
This commit is contained in:
parent
20587a0dac
commit
6b3d588724
@ -877,6 +877,7 @@ TabChild::TabChild(nsIContentChild* aManager,
|
|||||||
, mDefaultScale(0)
|
, mDefaultScale(0)
|
||||||
, mIPCOpen(true)
|
, mIPCOpen(true)
|
||||||
, mParentIsActive(false)
|
, mParentIsActive(false)
|
||||||
|
, mAudioChannelActive(false)
|
||||||
{
|
{
|
||||||
// In the general case having the TabParent tell us if APZ is enabled or not
|
// In the general case having the TabParent tell us if APZ is enabled or not
|
||||||
// doesn't really work because the TabParent itself may not have a reference
|
// doesn't really work because the TabParent itself may not have a reference
|
||||||
@ -988,10 +989,39 @@ TabChild::Observe(nsISupports *aSubject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audioChannel != -1) {
|
if (audioChannel != -1 && mIPCOpen) {
|
||||||
nsAutoString active(aData);
|
// If the subject is not a wrapper, it is sent by the TabParent and we
|
||||||
unused << SendAudioChannelActivityNotification(audioChannel,
|
// should ignore it.
|
||||||
active.Equals(NS_LITERAL_STRING("active")));
|
nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
|
||||||
|
if (!wrapper) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We must have a window in order to compare the windowID contained into the
|
||||||
|
// wrapper.
|
||||||
|
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(WebNavigation());
|
||||||
|
if (!window) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t windowID = 0;
|
||||||
|
nsresult rv = wrapper->GetData(&windowID);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In theory a tabChild should contain just 1 top window, but let's double
|
||||||
|
// check it comparing the windowID.
|
||||||
|
if (window->WindowID() != windowID) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsAutoString activeStr(aData);
|
||||||
|
bool active = activeStr.EqualsLiteral("active");
|
||||||
|
if (active != mAudioChannelActive) {
|
||||||
|
mAudioChannelActive = active;
|
||||||
|
unused << SendAudioChannelActivityNotification(audioChannel, active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -659,6 +659,7 @@ private:
|
|||||||
double mDefaultScale;
|
double mDefaultScale;
|
||||||
bool mIPCOpen;
|
bool mIPCOpen;
|
||||||
bool mParentIsActive;
|
bool mParentIsActive;
|
||||||
|
bool mAudioChannelActive;
|
||||||
bool mAsyncPanZoomEnabled;
|
bool mAsyncPanZoomEnabled;
|
||||||
CSSSize mUnscaledInnerSize;
|
CSSSize mUnscaledInnerSize;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user