Bug 1186808 - Replace nsBaseHashtable::EnumerateRead() calls in dom/camera/ with iterators. r=mikeh.

--HG--
extra : rebase_source : f332c1005449f2988936ad82cbfce1c3f65bcd7a
This commit is contained in:
Nicholas Nethercote 2015-11-22 14:39:01 -08:00
Родитель 6e21f29356
Коммит 0f6b051df6
6 изменённых файлов: 14 добавлений и 49 удалений

Просмотреть файл

@ -2213,17 +2213,6 @@ nsGonkCameraControl::LoadRecorderProfiles()
return NS_OK;
}
/* static */ PLDHashOperator
nsGonkCameraControl::Enumerate(const nsAString& aProfileName,
RecorderProfile* aProfile,
void* aUserArg)
{
nsTArray<nsString>* profiles = static_cast<nsTArray<nsString>*>(aUserArg);
MOZ_ASSERT(profiles);
profiles->AppendElement(aProfileName);
return PL_DHASH_NEXT;
}
nsresult
nsGonkCameraControl::GetRecorderProfiles(nsTArray<nsString>& aProfiles)
{
@ -2233,7 +2222,9 @@ nsGonkCameraControl::GetRecorderProfiles(nsTArray<nsString>& aProfiles)
}
aProfiles.Clear();
mRecorderProfiles.EnumerateRead(Enumerate, static_cast<void*>(&aProfiles));
for (auto iter = mRecorderProfiles.Iter(); !iter.Done(); iter.Next()) {
aProfiles.AppendElement(iter.Key());
}
return NS_OK;
}

Просмотреть файл

@ -156,9 +156,6 @@ protected:
void CreatePoster(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight, int32_t aRotation);
nsresult LoadRecorderProfiles();
static PLDHashOperator Enumerate(const nsAString& aProfileName,
RecorderProfile* aProfile,
void* aUserArg);
friend class SetPictureSize;
friend class SetThumbnailSize;

Просмотреть файл

@ -69,27 +69,19 @@ GonkCameraParameters::FindVendorSpecificKey(const char* aPotentialKeys[],
return nullptr;
}
/* static */ PLDHashOperator
GonkCameraParameters::EnumerateFlatten(const nsACString& aKey,
nsCString* aValue,
void* aUserArg)
{
nsCString* data = static_cast<nsCString*>(aUserArg);
if (!data->IsEmpty()) {
data->Append(';');
}
data->Append(aKey);
data->Append('=');
data->Append(*aValue);
return PL_DHASH_NEXT;
}
String8
GonkCameraParameters::Flatten() const
{
MutexAutoLock lock(mLock);
nsCString data;
mParams.EnumerateRead(EnumerateFlatten, static_cast<void*>(&data));
for (auto iter = mParams.ConstIter(); !iter.Done(); iter.Next()) {
if (!data.IsEmpty()) {
data.Append(';');
}
data.Append(iter.Key());
data.Append('=');
data.Append(*iter.UserData());
}
return String8(data.Data());
}

Просмотреть файл

@ -93,8 +93,6 @@ protected:
nsClassHashtable<nsStringHashKey, nsCString> mIsoModeMap;
nsClassHashtable<nsCStringHashKey, nsCString> mParams;
static PLDHashOperator EnumerateFlatten(const nsACString& aKey, nsCString* aValue, void* aUserArg);
nsresult SetImpl(const char* aKey, const char* aValue)
{
if (!aValue || strchr(aValue, ';') || strchr(aValue, '=')) {

Просмотреть файл

@ -269,18 +269,6 @@ GonkRecorderProfile::GonkRecorderProfile(uint32_t aCameraId,
mIsValid = isValid && mAudio.IsValid() && mVideo.IsValid();
}
/* static */ PLDHashOperator
GonkRecorderProfile::Enumerate(const nsAString& aProfileName,
GonkRecorderProfile* aProfile,
void* aUserArg)
{
nsTArray<RefPtr<ICameraControl::RecorderProfile>>* profiles =
static_cast<nsTArray<RefPtr<ICameraControl::RecorderProfile>>*>(aUserArg);
MOZ_ASSERT(profiles);
profiles->AppendElement(aProfile);
return PL_DHASH_NEXT;
}
/* static */
already_AddRefed<GonkRecorderProfile>
GonkRecorderProfile::CreateProfile(uint32_t aCameraId, int aQuality)
@ -379,7 +367,9 @@ GonkRecorderProfile::GetAll(uint32_t aCameraId,
}
aProfiles.Clear();
profiles->EnumerateRead(Enumerate, static_cast<void*>(&aProfiles));
for (auto iter = profiles->Iter(); !iter.Done(); iter.Next()) {
aProfiles.AppendElement(iter.UserData());
}
return NS_OK;
}

Просмотреть файл

@ -142,9 +142,6 @@ protected:
static already_AddRefed<GonkRecorderProfile> CreateProfile(uint32_t aCameraId,
int aQuality);
static ProfileHashtable* GetProfileHashtable(uint32_t aCameraId);
static PLDHashOperator Enumerate(const nsAString& aProfileName,
GonkRecorderProfile* aProfile,
void* aUserArg);
uint32_t mCameraId;
int mQuality;