tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

QuotaPrefs.cpp (1570B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "QuotaPrefs.h"
      8 
      9 #include "mozilla/StaticPrefs_dom.h"
     10 #include "prenv.h"
     11 
     12 // The STATIC_PREF macro helps avoid lines exceeding 80 characters due to
     13 // long method names generated from StaticPrefList.yaml. It constructs
     14 // method names by concatenating components of the preference path.
     15 #define STATIC_PREF(b1, b2, b3, b4) \
     16  StaticPrefs::b1##_##b2##_##b3##_##b4##_DoNotUseDirectly
     17 
     18 namespace mozilla::dom::quota {
     19 
     20 // static
     21 bool QuotaPrefs::LazyOriginInitializationEnabled() {
     22  return IncrementalOriginInitializationEnabled() ||
     23         STATIC_PREF(dom, quotaManager, temporaryStorage,
     24                     lazyOriginInitialization)();
     25 }
     26 
     27 // static
     28 bool QuotaPrefs::TriggerOriginInitializationInBackgroundEnabled() {
     29  return IncrementalOriginInitializationEnabled() ||
     30         STATIC_PREF(dom, quotaManager, temporaryStorage,
     31                     triggerOriginInitializationInBackground)();
     32 }
     33 
     34 // static
     35 bool QuotaPrefs::IncrementalOriginInitializationEnabled() {
     36  if (STATIC_PREF(dom, quotaManager, temporaryStorage,
     37                  incrementalOriginInitialization)()) {
     38    return true;
     39  }
     40 
     41  const char* env = PR_GetEnv("MOZ_ENABLE_INC_ORIGIN_INIT");
     42  return (env && *env == '1');
     43 }
     44 
     45 }  // namespace mozilla::dom::quota