Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / startupcache / StartupCacheInfo.cpp
blob973d3046d314e4ebd064b147bec1b593219c38b6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "StartupCache.h"
7 #include "StartupCacheInfo.h"
9 #include "mozilla/Components.h"
10 #include "mozilla/RefPtr.h"
11 #include "mozilla/StaticPtr.h"
13 using namespace mozilla;
14 using namespace mozilla::scache;
16 NS_IMPL_ISUPPORTS(StartupCacheInfo, nsIStartupCacheInfo)
18 nsresult StartupCacheInfo::GetIgnoreDiskCache(bool* aIgnore) {
19 *aIgnore = StartupCache::gIgnoreDiskCache;
20 return NS_OK;
23 nsresult StartupCacheInfo::GetFoundDiskCacheOnInit(bool* aFound) {
24 *aFound = StartupCache::gFoundDiskCacheOnInit;
25 return NS_OK;
28 nsresult StartupCacheInfo::GetWroteToDiskCache(bool* aWrote) {
29 if (!StartupCache::gStartupCache) {
30 *aWrote = false;
31 } else {
32 MutexAutoLock lock(StartupCache::gStartupCache->mTableLock);
33 *aWrote = StartupCache::gStartupCache->mWrittenOnce;
35 return NS_OK;
38 nsresult StartupCacheInfo::GetDiskCachePath(nsAString& aResult) {
39 if (!StartupCache::gStartupCache || !StartupCache::gStartupCache->mFile) {
40 return NS_OK;
42 nsAutoString path;
43 StartupCache::gStartupCache->mFile->GetPath(path);
44 aResult.Assign(path);
45 return NS_OK;
48 NS_IMPL_COMPONENT_FACTORY(nsIStartupCacheInfo) {
49 return MakeAndAddRef<StartupCacheInfo>().downcast<nsISupports>();