Bug 1729469 [wpt PR 30378] - Stretch nested columns to the block-size of the outer...
[gecko.git] / dom / quota / QuotaManagerService.h
blobc624a4bdeee801403a211515e5e8e1c39df94280
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/. */
7 #ifndef mozilla_dom_quota_QuotaManagerService_h
8 #define mozilla_dom_quota_QuotaManagerService_h
10 #include <cstdint>
11 #include "ErrorList.h"
12 #include "mozilla/AlreadyAddRefed.h"
13 #include "mozilla/HalBatteryInformation.h"
14 #include "mozilla/dom/ipc/IdType.h"
15 #include "nsIObserver.h"
16 #include "nsIQuotaManagerService.h"
17 #include "nsISupports.h"
19 #define QUOTAMANAGER_SERVICE_CONTRACTID \
20 "@mozilla.org/dom/quota-manager-service;1"
22 class nsIPrincipal;
23 class nsIQuotaRequest;
24 class nsIQuotaUsageCallback;
25 class nsIQuotaUsageRequest;
27 namespace mozilla {
28 namespace ipc {
30 class PBackgroundChild;
32 } // namespace ipc
34 namespace hal {
35 class BatteryInformation;
38 namespace dom {
39 namespace quota {
41 class QuotaChild;
42 class QuotaManager;
44 class QuotaManagerService final : public nsIQuotaManagerService,
45 public nsIObserver,
46 public hal::BatteryObserver {
47 using PBackgroundChild = mozilla::ipc::PBackgroundChild;
49 class BackgroundCreateCallback;
50 class PendingRequestInfo;
51 class UsageRequestInfo;
52 class RequestInfo;
53 class IdleMaintenanceInfo;
55 QuotaChild* mBackgroundActor;
57 bool mBackgroundActorFailed;
58 bool mIdleObserverRegistered;
60 public:
61 // Returns a non-owning reference.
62 static QuotaManagerService* GetOrCreate();
64 // Returns a non-owning reference.
65 static QuotaManagerService* Get();
67 // No one should call this but the factory.
68 static already_AddRefed<QuotaManagerService> FactoryCreate();
70 void ClearBackgroundActor();
72 // Called when a process is being shot down. Aborts any running operations
73 // for the given process.
74 void AbortOperationsForProcess(ContentParentId aContentParentId);
76 private:
77 QuotaManagerService();
78 ~QuotaManagerService();
80 nsresult Init();
82 void Destroy();
84 nsresult EnsureBackgroundActor();
86 nsresult InitiateRequest(PendingRequestInfo& aInfo);
88 void PerformIdleMaintenance();
90 void RemoveIdleObserver();
92 NS_DECL_ISUPPORTS
93 NS_DECL_NSIQUOTAMANAGERSERVICE
94 NS_DECL_NSIOBSERVER
96 // BatteryObserver override
97 void Notify(const hal::BatteryInformation& aBatteryInfo) override;
100 } // namespace quota
101 } // namespace dom
102 } // namespace mozilla
104 #endif /* mozilla_dom_quota_QuotaManagerService_h */