Bug 1262067 - Call Init() instead of using profile-after-changed observer. r=eeejay
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 05 Apr 2016 18:25:26 +0900
changeset 330968 3a5d44c806e50e4be1cf7a3d2e674c2faa632b88
parent 330967 3f87c987333bc59831fe9a3142abbad591a9f3f9
child 330969 19617346330c447a3c380995e6ca113dbaeb8024
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1262067, 1254378
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();