Files
palemoon27/netwerk/cache2/CacheObserver.h
T
roytam1 2c8ca451b9 import changes from `dev' branch of rmottola/Arctic-Fox:
- bits of Bug 571294 - Part 1: Implement selection events (8af4ef3f65)
- Bug 1208885 - Remove mozGenericWordUtils; r=smaug (b1a529f772)
- fix nsRefPtr/RefPtr (c56979e04d)
- Bug 1243657 spellchecker should check if IME composition works as deleting whole text r=ehsan (8b4d4825b9)
- Bug 1137544 - New scripts to upgrade en-US.dic to the latest upstream version; r=ehsan (47150b3549)
- Bug 1137544 - Upgrade en-US.dic dictionary to upstream version 2015.02.15; r=ehsan (057540f06b)
- Bug 1137544 - Generate 5-mozilla-added and 5-mozilla-removed to aid in submitting changes upstream; r=ehsan (f0d6332df3)
- Bug 1137544 - Update the en-US dictionary based on the SCOWL 2015.04.24 wordlist using the new scripts (e87b0a0285)
- minor test alignment (f3e976adf2)
- Bug 1162823 - Do not treat non-Latin words as misspelled; r=ekanan (c298db7251)
- Bug 1160730 - Add composited, compositing and compositeness to the en-US dictionary. r=ehsan (7d62babbdb)
- Bug 1167912 - Add eldritch to the en-US dictionary. r=ehsan (4d1e08e03b)
- Bug 1168802 - Update the en-US dictionary to SCOWL 2015.05.18 (3daa6d0831)
- Bug 1183765 - Add crappiness to our en-US dictionary. r=ehsan (54ccd28fa2)
- Bug 1192054 - Add subsumption to the en-US dictionary. r=ehsan (8c5aaa92bc)
- Bug 1199540 - Update the en-US dictionary to SCOWL 2015.08.24 (cb21d0092d)
- Bug 1200508 - Add dialogs to the en-US dictionary. r=ehsan (1e69b4d574)
- Bug 1202600 - Add Fukushima to the en-US dictionary. r=ehsan (6ffca1c47b)
- Bug 1213765 - Add preliminarily to the en-US dictionary. r=ehsan (cb12d4979b)
- Bug 1228174 - Add validator to the en-US dictionary. r=ehsan (b356d7f5cb)
- Bug 1199532 - Add disassembly, disassembler to the en-US dictionary. r=ehsan (979bb4f997)
- Bug 1235506 - Correct 353 entries in the en-US dictionary. r=ehsan (efb2f4a890)
- Bug 1238031 - Fix make-new-dict to use a custom en_US dictionary that adds common variants and accented words. r=ehsan (39464a234f)
- Bug 301712 - Remove uncommon proper names, remove unneeded words. r=ehsan (a6ece3925f)
- Bug 1240916 - Part 2: Update the en-US dictionary to SCOWL 2016.01.19 (bb059318e5)
- Bug 1196784 - imageset will use permissions.default.image. r=jdm (9a5669f71f)
- Bug 1182727 - Part 16: Fix a bug in build_tar_package (1d8f444eba)
- Bug 1182727 - Part 19: Fix another stupid mistake in build_tar_package() (87bb241693)
- Bug 1261264 - Apply GCC PR64905 to fix miscompilation with -fomit-frame-pointer. r=froydnj (d746a0c878)
- missing option, for safety (6fba93dff9)
- Bug 1260605 - Remove hack from bug 967556. r=nalexander (9513dbcd26)
- Bug 1239789 - Add secondary buffers to zxx_stream::StaticAllocator to handle reentrancy. r=glandium (74b60ffaad)
- Bug 1260351 - MozGlue: Build: Add mips support. r=glandium (8a463032f6)
- Bug 1249849: Ensure that we can always reach malloc_decl.h even when MOZ_REPLACE_ALLOC is not defined; r=glandium (1a8d0356ac)
- Bug 1248915 - TSan: data race on global 'mozilla::net::CacheObserver::sDiskCacheCapacity'. r=honzab.moz, n.nethercote. (86769cd893)
- Bug 1249157 - prefapi enums into class enums, explicit conversion, cleanup. r=bsmedberg (1843c09593)
- Bug 1251393: Remove a duplicated line. r=me (c2bca1a4f4)
2024-07-10 14:39:20 +08:00

106 lines
3.5 KiB
C++

/* 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/. */
#ifndef CacheObserver__h__
#define CacheObserver__h__
#include "nsIObserver.h"
#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include <algorithm>
namespace mozilla {
namespace net {
class CacheObserver : public nsIObserver
, public nsSupportsWeakReference
{
virtual ~CacheObserver() {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIOBSERVER
static nsresult Init();
static nsresult Shutdown();
static CacheObserver* Self() { return sSelf; }
// Access to preferences
static bool UseNewCache();
static bool UseDiskCache()
{ return sUseDiskCache; }
static bool UseMemoryCache()
{ return sUseMemoryCache; }
static uint32_t MetadataMemoryLimit() // result in bytes.
{ return sMetadataMemoryLimit << 10; }
static uint32_t MemoryCacheCapacity(); // result in bytes.
static uint32_t DiskCacheCapacity() // result in bytes.
{ return sDiskCacheCapacity << 10; }
static void SetDiskCacheCapacity(uint32_t); // parameter in bytes.
static uint32_t DiskFreeSpaceSoftLimit() // result in bytes.
{ return sDiskFreeSpaceSoftLimit << 10; }
static uint32_t DiskFreeSpaceHardLimit() // result in bytes.
{ return sDiskFreeSpaceHardLimit << 10; }
static bool SmartCacheSizeEnabled()
{ return sSmartCacheSizeEnabled; }
static uint32_t PreloadChunkCount()
{ return sPreloadChunkCount; }
static uint32_t MaxMemoryEntrySize() // result in bytes.
{ return sMaxMemoryEntrySize << 10; }
static uint32_t MaxDiskEntrySize() // result in bytes.
{ return sMaxDiskEntrySize << 10; }
static uint32_t MaxDiskChunksMemoryUsage(bool aPriority) // result in bytes.
{ return aPriority ? sMaxDiskPriorityChunksMemoryUsage << 10
: sMaxDiskChunksMemoryUsage << 10; }
static uint32_t CompressionLevel()
{ return sCompressionLevel; }
static uint32_t HalfLifeSeconds()
{ return sHalfLifeHours * 60.0F * 60.0F; }
static int32_t HalfLifeExperiment()
{ return sHalfLifeExperiment; }
static bool ClearCacheOnShutdown()
{ return sSanitizeOnShutdown && sClearCacheOnShutdown; }
static void ParentDirOverride(nsIFile ** aDir);
static bool EntryIsTooBig(int64_t aSize, bool aUsingDisk);
static TimeDuration const& MaxShutdownIOLag();
private:
static CacheObserver* sSelf;
void StoreDiskCacheCapacity();
void AttachToPreferences();
static uint32_t sUseNewCache;
static bool sUseMemoryCache;
static bool sUseDiskCache;
static uint32_t sMetadataMemoryLimit;
static int32_t sMemoryCacheCapacity;
static int32_t sAutoMemoryCacheCapacity;
static Atomic<uint32_t, Relaxed> sDiskCacheCapacity;
static uint32_t sDiskFreeSpaceSoftLimit;
static uint32_t sDiskFreeSpaceHardLimit;
static bool sSmartCacheSizeEnabled;
static uint32_t sPreloadChunkCount;
static int32_t sMaxMemoryEntrySize;
static int32_t sMaxDiskEntrySize;
static uint32_t sMaxDiskChunksMemoryUsage;
static uint32_t sMaxDiskPriorityChunksMemoryUsage;
static uint32_t sCompressionLevel;
static float sHalfLifeHours;
static int32_t sHalfLifeExperiment;
static bool sSanitizeOnShutdown;
static bool sClearCacheOnShutdown;
static int32_t sMaxShutdownIOLag;
// Non static properties, accessible via sSelf
nsCOMPtr<nsIFile> mCacheParentDirectoryOverride;
};
} // namespace net
} // namespace mozilla
#endif