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
df50e4c916
commit
3a9a500121
@ -877,6 +877,7 @@ TabChild::TabChild(nsIContentChild* aManager,
|
||||
, mDefaultScale(0)
|
||||
, mIPCOpen(true)
|
||||
, mParentIsActive(false)
|
||||
, mAudioChannelActive(false)
|
||||
{
|
||||
// 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
|
||||
@ -988,10 +989,39 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
}
|
||||
}
|
||||
|
||||
if (audioChannel != -1) {
|
||||
nsAutoString active(aData);
|
||||
unused << SendAudioChannelActivityNotification(audioChannel,
|
||||
active.Equals(NS_LITERAL_STRING("active")));
|
||||
if (audioChannel != -1 && mIPCOpen) {
|
||||
// If the subject is not a wrapper, it is sent by the TabParent and we
|
||||
// should ignore it.
|
||||
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;
|
||||
|
@ -659,6 +659,7 @@ private:
|
||||
double mDefaultScale;
|
||||
bool mIPCOpen;
|
||||
bool mParentIsActive;
|
||||
bool mAudioChannelActive;
|
||||
bool mAsyncPanZoomEnabled;
|
||||
CSSSize mUnscaledInnerSize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user