mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1320275
- QuotaManager must be registered as battery observer before calling hal:GetCurrentBatteryInformation, r=janv
This commit is contained in:
parent
880566d51c
commit
3eb6049ec1
@ -441,7 +441,11 @@ QuotaManagerService::PerformIdleMaintenance()
|
||||
if (!QuotaManager::kRunningXPCShellTests)
|
||||
#endif
|
||||
{
|
||||
// In order to give the correct battery level, hal must have registered
|
||||
// battery observers.
|
||||
RegisterBatteryObserver(this);
|
||||
GetCurrentBatteryInformation(&batteryInfo);
|
||||
UnregisterBatteryObserver(this);
|
||||
}
|
||||
|
||||
// If we're running XPCShell because we always want to be able to test this
|
||||
@ -707,6 +711,13 @@ QuotaManagerService::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
QuotaManagerService::Notify(const hal::BatteryInformation& aBatteryInfo)
|
||||
{
|
||||
// This notification is received when battery data changes. We don't need to
|
||||
// deal with this notification.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AbortOperationsRunnable::Run()
|
||||
{
|
||||
|
@ -8,6 +8,8 @@
|
||||
#define mozilla_dom_quota_QuotaManagerService_h
|
||||
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/dom/battery/Types.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIQuotaManagerService.h"
|
||||
@ -22,6 +24,10 @@ class PBackgroundChild;
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
namespace hal {
|
||||
class BatteryInformation;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
namespace quota {
|
||||
|
||||
@ -31,6 +37,7 @@ class QuotaManager;
|
||||
class QuotaManagerService final
|
||||
: public nsIQuotaManagerService
|
||||
, public nsIObserver
|
||||
, public BatteryObserver
|
||||
{
|
||||
typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
|
||||
|
||||
@ -104,6 +111,10 @@ private:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIQUOTAMANAGERSERVICE
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
// BatteryObserver override
|
||||
void
|
||||
Notify(const hal::BatteryInformation& aBatteryInfo) override;
|
||||
};
|
||||
|
||||
} // namespace quota
|
||||
|
Loading…
Reference in New Issue
Block a user