//static already_AddRefed<Volume> VolumeManager::GetVolume(size_t aIndex) { MOZ_ASSERT(aIndex < NumVolumes()); RefPtr<Volume> vol = sVolumeManager->mVolumeArray[aIndex]; return vol.forget(); }
//static void VolumeManager::Dump(const char* aLabel) { if (!sVolumeManager) { LOG("%s: sVolumeManager == null", aLabel); return; } VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { RefPtr<Volume> vol = GetVolume(volIndex); vol->Dump(aLabel); } }
//static already_AddRefed<Volume> VolumeManager::FindVolumeByName(const nsCSubstring& aName) { if (!sVolumeManager) { return nullptr; } VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { RefPtr<Volume> vol = GetVolume(volIndex); if (vol->Name().Equals(aName)) { return vol.forget(); } } return nullptr; }
//static TemporaryRef<Volume> VolumeManager::FindVolumeByName(const nsCSubstring &aName) { if (!sVolumeManager) { return NULL; } VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { RefPtr<Volume> vol = GetVolume(volIndex); if (vol->Name().Equals(aName)) { return vol; } } return NULL; }
//static bool VolumeManager::RemoveVolumeByName(const nsCSubstring& aName) { if (!sVolumeManager) { return false; } VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { RefPtr<Volume> vol = GetVolume(volIndex); if (vol->Name().Equals(aName)) { sVolumeManager->mVolumeArray.RemoveElementAt(volIndex); return true; } } // No volume found. Return false to indicate this. return false; }
//static TemporaryRef<Volume> VolumeManager::GetVolume(size_t aIndex) { MOZ_ASSERT(aIndex < NumVolumes()); return sVolumeManager->mVolumeArray[aIndex]; }