Bug 1262067 - Call Init() instead of using profile-after-changed observer. r?eeejay draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 05 Apr 2016 18:25:26 +0900
changeset 347583 fc57de23778e6d52dc3a14f07cc61a0376fc7e51
parent 347582 d9f50aa0a1aaf90499b85c31e0f329b762e80fdd
child 517657 7d837d8972c9d8c1923c3b5347e7d2f698b80b57
push id14609
push userm_kato@ga2.so-net.ne.jp
push dateTue, 05 Apr 2016 09:32:05 +0000
reviewerseeejay
bugs1262067, 1254378
milestone48.0a1
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
dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
--- 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();