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 0489868 commit 208c7d9
Showing 1 changed file with 208 additions and 22 deletions.
230 changes: 208 additions & 22 deletions dom/media/eme/mediafoundation/WMFCDMImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,24 @@ include
"
mozilla
/
AppShutdown
.
h
"
#
include
"
mozilla
/
ClearOnShutdown
.
h
"
#
include
"
mozilla
/
dom
/
MediaKeySession
Expand Down Expand Up @@ -166,6 +184,31 @@ nsAString
aKeySystem
)
{
MOZ_ASSERT
(
NS_IsMainThread
(
)
)
;
if
(
AppShutdown
:
:
IsInOrBeyond
(
ShutdownPhase
:
:
AppShutdownConfirmed
)
)
{
return
false
;
}
static
std
:
Expand All @@ -175,8 +218,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 @@ -190,7 +292,7 @@ auto
&
s
=
supports
sSupports
.
find
(
Expand All @@ -200,7 +302,7 @@ key
s
!
=
supports
sSupports
.
end
(
Expand Down Expand Up @@ -245,7 +347,7 @@ GetCapabilities
configs
)
;
supports
sSupports
[
key
]
Expand All @@ -270,30 +372,31 @@ KeySystemConfig
aOutConfigs
)
{
nsCOMPtr
<
nsISerialEventTarget
>
backgroundTaskQueue
MOZ_ASSERT
(
NS_IsMainThread
(
)
)
;
NS_CreateBackgroundTaskQueue
if
(
__func__
getter_AddRefs
AppShutdown
:
:
IsInOrBeyond
(
backgroundTaskQueue
ShutdownPhase
:
:
AppShutdownConfirmed
)
)
{
return
false
;
/
/
Retrieve
result
from
our
cached
key
system
}
static
std
:
Expand All @@ -313,6 +416,74 @@ sKeySystemConfigs
{
}
;
static
bool
sSetRunOnShutdown
=
false
;
if
(
!
sSetRunOnShutdown
)
{
GetMainThreadSerialEventTarget
(
)
-
>
Dispatch
(
NS_NewRunnableFunction
(
"
WMFCDMImpl
:
:
GetCapabilities
"
[
&
]
{
RunOnShutdown
(
[
&
]
{
sKeySystemConfigs
.
clear
(
)
;
}
ShutdownPhase
:
:
XPCOMShutdown
)
;
}
)
)
;
sSetRunOnShutdown
=
true
;
}
/
/
Retrieve
result
from
our
cached
key
system
auto
keySystem
=
Expand Down Expand Up @@ -430,6 +601,21 @@ the
remote
process
.
nsCOMPtr
<
nsISerialEventTarget
>
backgroundTaskQueue
;
NS_CreateBackgroundTaskQueue
(
__func__
getter_AddRefs
(
backgroundTaskQueue
)
)
;
if
(
!
Expand Down

0 comments on commit 208c7d9

Please sign in to comment.