From 1fd9961689e0eea98e5b73e31047a144470f186e Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Wed, 23 Mar 2016 10:32:58 -0700 Subject: [PATCH] Bug 1254378 - Make new 'speech-synth-started' component service category. r=smaug MozReview-Commit-ID: LsPDCdpUA48 --HG-- extra : rebase_source : 5ebebebb601a54959c49d9e4b87c8f96be4ff2c7 --- .../webspeech/synth/cocoa/OSXSpeechSynthesizerModule.cpp | 4 ++-- dom/media/webspeech/synth/nsISpeechService.idl | 6 ++++++ dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp | 6 ++++++ .../webspeech/synth/speechd/SpeechDispatcherModule.cpp | 2 +- dom/media/webspeech/synth/windows/SapiModule.cpp | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerModule.cpp b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerModule.cpp index 17370a25a345..bc80eb06e770 100644 --- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerModule.cpp +++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerModule.cpp @@ -20,7 +20,7 @@ using namespace mozilla::dom; NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(OSXSpeechSynthesizerService, OSXSpeechSynthesizerService::GetInstanceForService) -// Defines kSAPISERVICE_CID +// Defines kOSXSERVICE_CID NS_DEFINE_NAMED_CID(OSXSPEECHSYNTHESIZERSERVICE_CID); static const mozilla::Module::CIDEntry kCIDs[] = { @@ -34,7 +34,7 @@ static const mozilla::Module::ContractIDEntry kContracts[] = { }; static const mozilla::Module::CategoryEntry kCategories[] = { - { "profile-after-change", "Sapi Speech Synth", OSXSPEECHSYNTHESIZERSERVICE_CONTRACTID }, + { "speech-synth-started", "OSX Speech Synth", OSXSPEECHSYNTHESIZERSERVICE_CONTRACTID }, { nullptr } }; diff --git a/dom/media/webspeech/synth/nsISpeechService.idl b/dom/media/webspeech/synth/nsISpeechService.idl index c802837155d0..710686f1ed80 100644 --- a/dom/media/webspeech/synth/nsISpeechService.idl +++ b/dom/media/webspeech/synth/nsISpeechService.idl @@ -165,3 +165,9 @@ interface nsISpeechService : nsISupports readonly attribute SpeechServiceType serviceType; }; + +%{C++ +// This is the service category speech services could use to start up as +// a component. +#define NS_SPEECH_SYNTH_STARTED "speech-synth-started" +%} diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index 59c76d158268..e36be7e78c84 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -7,6 +7,7 @@ #include "nsILocaleService.h" #include "nsISpeechService.h" #include "nsServiceManagerUtils.h" +#include "nsCategoryManagerUtils.h" #include "SpeechSynthesisUtterance.h" #include "SpeechSynthesisVoice.h" @@ -190,6 +191,11 @@ nsSynthVoiceRegistry::GetInstance() gSynthVoiceRegistry = new nsSynthVoiceRegistry(); Preferences::AddBoolVarCache(&sForceGlobalQueue, "media.webspeech.synth.force_global_queue"); + if (XRE_IsParentProcess()) { + // Start up all speech synth services. + NS_CreateServicesFromCategory(NS_SPEECH_SYNTH_STARTED, nullptr, + NS_SPEECH_SYNTH_STARTED); + } } return gSynthVoiceRegistry; diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp index deed7c1d29b4..a7f7ad5352c5 100644 --- a/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp +++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp @@ -33,7 +33,7 @@ static const mozilla::Module::ContractIDEntry kContracts[] = { }; static const mozilla::Module::CategoryEntry kCategories[] = { - { "profile-after-change", "SpeechDispatcher Speech Synth", SPEECHDISPATCHERSERVICE_CONTRACTID }, + { "speech-synth-started", "SpeechDispatcher Speech Synth", SPEECHDISPATCHERSERVICE_CONTRACTID }, { nullptr } }; diff --git a/dom/media/webspeech/synth/windows/SapiModule.cpp b/dom/media/webspeech/synth/windows/SapiModule.cpp index 729dabcba37a..f9d7c9a89d57 100644 --- a/dom/media/webspeech/synth/windows/SapiModule.cpp +++ b/dom/media/webspeech/synth/windows/SapiModule.cpp @@ -34,7 +34,7 @@ static const mozilla::Module::ContractIDEntry kContracts[] = { }; static const mozilla::Module::CategoryEntry kCategories[] = { - { "profile-after-change", "Sapi Speech Synth", SAPISERVICE_CONTRACTID }, + { "speech-synth-started", "Sapi Speech Synth", SAPISERVICE_CONTRACTID }, { nullptr } };