Bug 1653060 - P3. Use nsCOMPtr. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D90486
This commit is contained in:
Jean-Yves Avenard 2020-09-17 06:57:58 +00:00
Родитель 04f8c82986
Коммит 4bb1eaa8e6
3 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -9,11 +9,11 @@
namespace mozilla {
namespace media {
RefPtr<nsIAsyncShutdownClient> GetShutdownBarrier() {
nsCOMPtr<nsIAsyncShutdownClient> GetShutdownBarrier() {
nsCOMPtr<nsIAsyncShutdownService> svc = services::GetAsyncShutdownService();
MOZ_RELEASE_ASSERT(svc);
RefPtr<nsIAsyncShutdownClient> barrier;
nsCOMPtr<nsIAsyncShutdownClient> barrier;
nsresult rv = svc->GetProfileBeforeChange(getter_AddRefs(barrier));
if (!barrier) {
// We are probably in a content process. We need to do cleanup at

Просмотреть файл

@ -142,7 +142,7 @@ class Refcountable<UniquePtr<T>> : public UniquePtr<T> {
/* Async shutdown helpers
*/
RefPtr<nsIAsyncShutdownClient> GetShutdownBarrier();
nsCOMPtr<nsIAsyncShutdownClient> GetShutdownBarrier();
class ShutdownBlocker : public nsIAsyncShutdownBlocker {
public:

Просмотреть файл

@ -623,10 +623,9 @@ SpeechRecognition::StartRecording(RefPtr<AudioStreamTrack>& aTrack) {
blockerName.AppendPrintf("SpeechRecognition %p shutdown", this);
mShutdownBlocker =
MakeAndAddRef<SpeechRecognitionShutdownBlocker>(this, blockerName);
RefPtr<nsIAsyncShutdownClient> shutdown = media::GetShutdownBarrier();
shutdown->AddBlocker(mShutdownBlocker,
NS_LITERAL_STRING_FROM_CSTRING(__FILE__), __LINE__,
u"SpeechRecognition shutdown"_ns);
media::GetShutdownBarrier()->AddBlocker(
mShutdownBlocker, NS_LITERAL_STRING_FROM_CSTRING(__FILE__), __LINE__,
u"SpeechRecognition shutdown"_ns);
mEndpointer.StartSession();
@ -675,9 +674,7 @@ RefPtr<GenericNonExclusivePromise> SpeechRecognition::StopRecording() {
->Then(
GetCurrentSerialEventTarget(), __func__,
[self = RefPtr<SpeechRecognition>(this), this] {
RefPtr<nsIAsyncShutdownClient> shutdown =
media::GetShutdownBarrier();
shutdown->RemoveBlocker(mShutdownBlocker);
media::GetShutdownBarrier()->RemoveBlocker(mShutdownBlocker);
mShutdownBlocker = nullptr;
MOZ_DIAGNOSTIC_ASSERT(mCurrentState != STATE_IDLE);