summaryrefslogtreecommitdiffstats
path: root/dom/system/gonk/nsVolumeService.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/system/gonk/nsVolumeService.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/system/gonk/nsVolumeService.h')
-rw-r--r--dom/system/gonk/nsVolumeService.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/dom/system/gonk/nsVolumeService.h b/dom/system/gonk/nsVolumeService.h
new file mode 100644
index 000000000..9bddc0b8f
--- /dev/null
+++ b/dom/system/gonk/nsVolumeService.h
@@ -0,0 +1,78 @@
+/* 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 dom {
+class VolumeInfo;
+} // dom
+
+namespace system {
+
+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 final : public nsIVolumeService,
+ public nsIDOMMozWakeLockListener
+{
+public:
+ NS_DECL_THREADSAFE_ISUPPORTS
+ NS_DECL_NSIVOLUMESERVICE
+ NS_DECL_NSIDOMMOZWAKELOCKLISTENER
+
+ nsVolumeService();
+
+ static already_AddRefed<nsVolumeService> GetSingleton();
+ //static nsVolumeService* GetSingleton();
+ static void Shutdown();
+
+ void DumpNoLock(const char* aLabel);
+
+ // To use this function, you have to create a new volume and pass it in.
+ void UpdateVolume(nsVolume* aVolume, bool aNotifyObservers = true);
+ void UpdateVolumeIOThread(const Volume* aVolume);
+
+ void RecvVolumesFromParent(const nsTArray<dom::VolumeInfo>& aVolumes);
+ void GetVolumesForIPC(nsTArray<dom::VolumeInfo>* aResult);
+
+ void RemoveVolumeByName(const nsAString& aName);
+
+private:
+ ~nsVolumeService();
+
+ void CheckMountLock(const nsAString& aMountLockName,
+ const nsAString& aMountLockState);
+ already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
+
+ already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName,
+ nsVolume::Array::index_type* aIndex = nullptr);
+
+ Monitor mArrayMonitor;
+ nsVolume::Array mVolumeArray;
+
+ static StaticRefPtr<nsVolumeService> sSingleton;
+ bool mGotVolumesFromParent;
+};
+
+} // system
+} // mozilla
+
+#endif // mozilla_system_nsvolumeservice_h__