зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1653060 - P3. Use nsCOMPtr. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D90486
This commit is contained in:
Родитель
04f8c82986
Коммит
4bb1eaa8e6
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче