dom/system/gonk/nsVolumeService.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef mozilla_system_nsvolumeservice_h__
     6 #define mozilla_system_nsvolumeservice_h__
     8 #include "mozilla/Monitor.h"
     9 #include "mozilla/RefPtr.h"
    10 #include "mozilla/StaticPtr.h"
    11 #include "nsCOMPtr.h"
    12 #include "nsIDOMWakeLockListener.h"
    13 #include "nsIVolume.h"
    14 #include "nsIVolumeService.h"
    15 #include "nsVolume.h"
    17 namespace mozilla {
    18 namespace system {
    20 class WakeLockCallback;
    21 class Volume;
    23 /***************************************************************************
    24 * The nsVolumeData class encapsulates the data that is updated/maintained
    25 * on the main thread in order to support the nsIVolume and nsIVolumeService
    26 * classes.
    27 */
    29 class nsVolumeService MOZ_FINAL : public nsIVolumeService,
    30                                   public nsIDOMMozWakeLockListener
    31 {
    32 public:
    33   NS_DECL_THREADSAFE_ISUPPORTS
    34   NS_DECL_NSIVOLUMESERVICE
    35   NS_DECL_NSIDOMMOZWAKELOCKLISTENER
    37   nsVolumeService();
    39   static already_AddRefed<nsVolumeService> GetSingleton();
    40   //static nsVolumeService* GetSingleton();
    41   static void Shutdown();
    43   void UpdateVolume(nsIVolume* aVolume);
    44   void UpdateVolumeIOThread(const Volume* aVolume);
    46 private:
    47   ~nsVolumeService();
    49   void CheckMountLock(const nsAString& aMountLockName,
    50                       const nsAString& aMountLockState);
    51   already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
    52   already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
    53   already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false);
    55   Monitor mArrayMonitor;
    56   nsVolume::Array mVolumeArray;
    58   static StaticRefPtr<nsVolumeService> sSingleton;
    59 };
    61 } // system
    62 } // mozilla
    64 #endif  // mozilla_system_nsvolumeservice_h__

mercurial