content/media/webspeech/synth/pico/PicoModule.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "mozilla/ModuleUtils.h"
     6 #include "nsIClassInfoImpl.h"
     8 #ifdef MOZ_WEBRTC
    10 #include "nsPicoService.h"
    12 using namespace mozilla::dom;
    14 #define PICOSERVICE_CID \
    15   {0x346c4fc8, 0x12fe, 0x459c, {0x81, 0x19, 0x9a, 0xa7, 0x73, 0x37, 0x7f, 0xf4}}
    17 #define PICOSERVICE_CONTRACTID "@mozilla.org/synthpico;1"
    19 // Defines nsPicoServiceConstructor
    20 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPicoService,
    21                                          nsPicoService::GetInstanceForService)
    23 // Defines kPICOSERVICE_CID
    24 NS_DEFINE_NAMED_CID(PICOSERVICE_CID);
    26 static const mozilla::Module::CIDEntry kCIDs[] = {
    27   { &kPICOSERVICE_CID, true, nullptr, nsPicoServiceConstructor },
    28   { nullptr }
    29 };
    31 static const mozilla::Module::ContractIDEntry kContracts[] = {
    32   { PICOSERVICE_CONTRACTID, &kPICOSERVICE_CID },
    33   { nullptr }
    34 };
    36 static const mozilla::Module::CategoryEntry kCategories[] = {
    37   { "profile-after-change", "Pico Speech Synth", PICOSERVICE_CONTRACTID },
    38   { nullptr }
    39 };
    41 static void
    42 UnloadPicoModule()
    43 {
    44   nsPicoService::Shutdown();
    45 }
    47 static const mozilla::Module kModule = {
    48   mozilla::Module::kVersion,
    49   kCIDs,
    50   kContracts,
    51   kCategories,
    52   nullptr,
    53   nullptr,
    54   UnloadPicoModule
    55 };
    57 NSMODULE_DEFN(synthpico) = &kModule;
    58 #endif

mercurial