Bug 1772603 [wpt PR 34303] - Add WPT test writing and reading back a 0.5 alpha fillSt...
[gecko.git] / startupcache / StartupCacheInfo.cpp
blob461948d9c2f29e90b605d4f8d58f6113d5d5276b
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 "StartupCacheInfo.h"
8 #include "mozilla/Components.h"
9 #include "mozilla/RefPtr.h"
11 using namespace mozilla;
12 using namespace mozilla::scache;
14 NS_IMPL_ISUPPORTS(StartupCacheInfo, nsIStartupCacheInfo)
16 nsresult StartupCacheInfo::GetIgnoreDiskCache(bool* aIgnore) {
17 *aIgnore = StartupCache::gIgnoreDiskCache;
18 return NS_OK;
21 nsresult StartupCacheInfo::GetFoundDiskCacheOnInit(bool* aFound) {
22 *aFound = StartupCache::gFoundDiskCacheOnInit;
23 return NS_OK;
26 nsresult StartupCacheInfo::GetWroteToDiskCache(bool* aWrote) {
27 if (!StartupCache::gStartupCache) {
28 *aWrote = false;
29 } else {
30 *aWrote = StartupCache::gStartupCache->mWrittenOnce;
32 return NS_OK;
35 nsresult StartupCacheInfo::GetDiskCachePath(nsAString& aResult) {
36 if (!StartupCache::gStartupCache || !StartupCache::gStartupCache->mFile) {
37 return NS_OK;
39 nsAutoString path;
40 StartupCache::gStartupCache->mFile->GetPath(path);
41 aResult.Assign(path);
42 return NS_OK;
45 NS_IMPL_COMPONENT_FACTORY(nsIStartupCacheInfo) {
46 return MakeAndAddRef<StartupCacheInfo>().downcast<nsISupports>();