Bug 1262067 - Call Init() instead of using profile-after-changed observer. r?eeejay
OSX speech synthesis is broken after landing
bug 1254378. By this bug, this service is never called on start up.
Although this observer is for start up time regression, it is unnecessary now. So it should be initialized at GetInstance() instead.
MozReview-Commit-ID: DTaXinCxkWR
--- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
+++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
@@ -416,32 +416,33 @@ OSXSpeechSynthesizerService::GetServiceT
*aServiceType = nsISpeechService::SERVICETYPE_INDIRECT_AUDIO;
return NS_OK;
}
NS_IMETHODIMP
OSXSpeechSynthesizerService::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData)
{
- if (!strcmp(aTopic, "profile-after-change")) {
- Init();
- }
return NS_OK;
}
OSXSpeechSynthesizerService*
OSXSpeechSynthesizerService::GetInstance()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return nullptr;
}
if (!sSingleton) {
- sSingleton = new OSXSpeechSynthesizerService();
+ RefPtr<OSXSpeechSynthesizerService> speechService =
+ new OSXSpeechSynthesizerService();
+ if (speechService->Init()) {
+ sSingleton = speechService;
+ }
}
return sSingleton;
}
already_AddRefed<OSXSpeechSynthesizerService>
OSXSpeechSynthesizerService::GetInstanceForService()
{
RefPtr<OSXSpeechSynthesizerService> speechService = GetInstance();