зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543009 - Move OSX webspeech xpcom component to static registration. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D26886
This commit is contained in:
Родитель
657307cf3a
Коммит
f2903b2101
|
@ -1,56 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
|
||||
#include "OSXSpeechSynthesizerService.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
#define OSXSPEECHSYNTHESIZERSERVICE_CID \
|
||||
{ \
|
||||
0x914e73b4, 0x6337, 0x4bef, { \
|
||||
0x97, 0xf3, 0x4d, 0x06, 0x9e, 0x05, 0x3a, 0x12 \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OSXSPEECHSYNTHESIZERSERVICE_CONTRACTID "@mozilla.org/synthsystem;1"
|
||||
|
||||
// Defines OSXSpeechSynthesizerServiceConstructor
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
|
||||
OSXSpeechSynthesizerService,
|
||||
OSXSpeechSynthesizerService::GetInstanceForService)
|
||||
|
||||
// Defines kOSXSERVICE_CID
|
||||
NS_DEFINE_NAMED_CID(OSXSPEECHSYNTHESIZERSERVICE_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kCIDs[] = {
|
||||
{&kOSXSPEECHSYNTHESIZERSERVICE_CID, true, nullptr,
|
||||
OSXSpeechSynthesizerServiceConstructor},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kContracts[] = {
|
||||
{OSXSPEECHSYNTHESIZERSERVICE_CONTRACTID, &kOSXSPEECHSYNTHESIZERSERVICE_CID},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kCategories[] = {
|
||||
{"speech-synth-started", "OSX Speech Synth",
|
||||
OSXSPEECHSYNTHESIZERSERVICE_CONTRACTID},
|
||||
{nullptr}};
|
||||
|
||||
static void UnloadOSXSpeechSynthesizerModule() {
|
||||
OSXSpeechSynthesizerService::Shutdown();
|
||||
}
|
||||
|
||||
extern const mozilla::Module kSpeechSynthModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kCIDs,
|
||||
kContracts,
|
||||
kCategories,
|
||||
nullptr,
|
||||
nullptr,
|
||||
UnloadOSXSpeechSynthesizerModule};
|
|
@ -25,7 +25,6 @@ class OSXSpeechSynthesizerService final : public nsISpeechService,
|
|||
|
||||
static OSXSpeechSynthesizerService* GetInstance();
|
||||
static already_AddRefed<OSXSpeechSynthesizerService> GetInstanceForService();
|
||||
static void Shutdown();
|
||||
|
||||
private:
|
||||
OSXSpeechSynthesizerService();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsObjCExceptions.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/nsSynthVoiceRegistry.h"
|
||||
#include "mozilla/dom/nsSpeechTask.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -412,6 +413,7 @@ OSXSpeechSynthesizerService* OSXSpeechSynthesizerService::GetInstance() {
|
|||
RefPtr<OSXSpeechSynthesizerService> speechService = new OSXSpeechSynthesizerService();
|
||||
if (speechService->Init()) {
|
||||
sSingleton = speechService;
|
||||
ClearOnShutdown(&sSingleton);
|
||||
}
|
||||
}
|
||||
return sSingleton;
|
||||
|
@ -422,12 +424,5 @@ already_AddRefed<OSXSpeechSynthesizerService> OSXSpeechSynthesizerService::GetIn
|
|||
return speechService.forget();
|
||||
}
|
||||
|
||||
void OSXSpeechSynthesizerService::Shutdown() {
|
||||
if (!sSingleton) {
|
||||
return;
|
||||
}
|
||||
sSingleton = nullptr;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{914e73b4-6337-4bef-97f3-4d069e053a12}',
|
||||
'contract_ids': ['@mozilla.org/synthsystem;1'],
|
||||
'singleton': True,
|
||||
'type': 'mozilla::dom::OSXSpeechSynthesizerService',
|
||||
'headers': ['/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.h'],
|
||||
'constructor': 'mozilla::dom::OSXSpeechSynthesizerService::GetInstanceForService',
|
||||
'categories': {"speech-synth-started": 'OSX Speech Synth'},
|
||||
},
|
||||
]
|
|
@ -5,8 +5,11 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
SOURCES += [
|
||||
'OSXSpeechSynthesizerModule.cpp',
|
||||
'OSXSpeechSynthesizerService.mm'
|
||||
'OSXSpeechSynthesizerService.mm',
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
'components.conf',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -351,7 +351,7 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
|||
mStatus(NOT_INITIALIZED) {}
|
||||
|
||||
extern const mozilla::Module kNeckoModule;
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
|
||||
#if defined(XP_WIN)
|
||||
extern const mozilla::Module kSpeechSynthModule;
|
||||
#endif
|
||||
extern const mozilla::Module kPowerManagerModule;
|
||||
|
@ -462,7 +462,7 @@ nsresult nsComponentManagerImpl::Init() {
|
|||
|
||||
RegisterModule(&kXPCOMModule);
|
||||
RegisterModule(&kNeckoModule);
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
|
||||
#if defined(XP_WIN)
|
||||
RegisterModule(&kSpeechSynthModule);
|
||||
#endif
|
||||
RegisterModule(&kPowerManagerModule);
|
||||
|
|
Загрузка…
Ссылка в новой задаче