Skip to content

Commit

Permalink
Bug 1825142 - part9 : fix string leaking in testing. r=media-playback…
Browse files Browse the repository at this point in the history
…-reviewers,aosmond

Differential Revision: https://phabricator.services.mozilla.com/D197404

UltraBlame original commit: f60458822ae12da6c40aca630e8afb8b8791ee7c
  • Loading branch information
marco-c committed Jan 16, 2024
1 parent 76bf92f commit 7937452
Showing 1 changed file with 199 additions and 13 deletions.
212 changes: 199 additions & 13 deletions dom/media/eme/mediafoundation/WMFCDMImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ include
"
mozilla
/
AppShutdown
.
h
"
#
include
"
mozilla
/
ClearOnShutdown
.
h
"
#
include
"
mozilla
/
dom
/
MediaKeySession
Expand Down Expand Up @@ -47,6 +65,31 @@ nsAString
aKeySystem
)
{
MOZ_ASSERT
(
NS_IsMainThread
(
)
)
;
if
(
AppShutdown
:
:
IsInOrBeyond
(
ShutdownPhase
:
:
AppShutdownConfirmed
)
)
{
return
false
;
}
static
std
:
Expand All @@ -56,8 +99,67 @@ map
nsString
bool
>
supports
sSupports
;
static
bool
sSetRunOnShutdown
=
false
;
if
(
!
sSetRunOnShutdown
)
{
GetMainThreadSerialEventTarget
(
)
-
>
Dispatch
(
NS_NewRunnableFunction
(
"
WMFCDMImpl
:
:
Supports
"
[
&
]
{
RunOnShutdown
(
[
&
]
{
sSupports
.
clear
(
)
;
}
ShutdownPhase
:
:
XPCOMShutdown
)
;
}
)
)
;
sSetRunOnShutdown
=
true
;
}
nsString
key
(
Expand All @@ -71,7 +173,7 @@ auto
&
s
=
supports
sSupports
.
find
(
Expand All @@ -81,7 +183,7 @@ key
s
!
=
supports
sSupports
.
end
(
Expand Down Expand Up @@ -126,7 +228,7 @@ GetCapabilities
configs
)
;
supports
sSupports
[
key
]
Expand All @@ -151,21 +253,31 @@ KeySystemConfig
aOutConfigs
)
{
nsCOMPtr
<
nsISerialEventTarget
>
backgroundTaskQueue
MOZ_ASSERT
(
NS_IsMainThread
(
)
)
;
NS_CreateBackgroundTaskQueue
if
(
__func__
getter_AddRefs
AppShutdown
:
:
IsInOrBeyond
(
backgroundTaskQueue
ShutdownPhase
:
:
AppShutdownConfirmed
)
)
{
return
false
;
}
static
std
:
Expand All @@ -185,6 +297,65 @@ sKeySystemConfigs
{
}
;
static
bool
sSetRunOnShutdown
=
false
;
if
(
!
sSetRunOnShutdown
)
{
GetMainThreadSerialEventTarget
(
)
-
>
Dispatch
(
NS_NewRunnableFunction
(
"
WMFCDMImpl
:
:
GetCapabilities
"
[
&
]
{
RunOnShutdown
(
[
&
]
{
sKeySystemConfigs
.
clear
(
)
;
}
ShutdownPhase
:
:
XPCOMShutdown
)
;
}
)
)
;
sSetRunOnShutdown
=
true
;
}
auto
keySystem
=
Expand Down Expand Up @@ -292,6 +463,21 @@ return
true
;
}
nsCOMPtr
<
nsISerialEventTarget
>
backgroundTaskQueue
;
NS_CreateBackgroundTaskQueue
(
__func__
getter_AddRefs
(
backgroundTaskQueue
)
)
;
if
(
!
Expand Down

0 comments on commit 7937452

Please sign in to comment.