diff -r 000000000000 -r 6474c204b198 dom/system/gonk/nsVolumeService.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/system/gonk/nsVolumeService.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,64 @@ +/* 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 mozilla_system_nsvolumeservice_h__ +#define mozilla_system_nsvolumeservice_h__ + +#include "mozilla/Monitor.h" +#include "mozilla/RefPtr.h" +#include "mozilla/StaticPtr.h" +#include "nsCOMPtr.h" +#include "nsIDOMWakeLockListener.h" +#include "nsIVolume.h" +#include "nsIVolumeService.h" +#include "nsVolume.h" + +namespace mozilla { +namespace system { + +class WakeLockCallback; +class Volume; + +/*************************************************************************** +* The nsVolumeData class encapsulates the data that is updated/maintained +* on the main thread in order to support the nsIVolume and nsIVolumeService +* classes. +*/ + +class nsVolumeService MOZ_FINAL : public nsIVolumeService, + public nsIDOMMozWakeLockListener +{ +public: + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSIVOLUMESERVICE + NS_DECL_NSIDOMMOZWAKELOCKLISTENER + + nsVolumeService(); + + static already_AddRefed GetSingleton(); + //static nsVolumeService* GetSingleton(); + static void Shutdown(); + + void UpdateVolume(nsIVolume* aVolume); + void UpdateVolumeIOThread(const Volume* aVolume); + +private: + ~nsVolumeService(); + + void CheckMountLock(const nsAString& aMountLockName, + const nsAString& aMountLockState); + already_AddRefed FindVolumeByMountLockName(const nsAString& aMountLockName); + already_AddRefed FindVolumeByName(const nsAString& aName); + already_AddRefed CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false); + + Monitor mArrayMonitor; + nsVolume::Array mVolumeArray; + + static StaticRefPtr sSingleton; +}; + +} // system +} // mozilla + +#endif // mozilla_system_nsvolumeservice_h__