зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1081375: Remove write-only datastructures. r=rnewman
This commit is contained in:
Родитель
fdedd36409
Коммит
ff5ab9b7f6
|
@ -70,13 +70,6 @@ public class GeckoProfilesProvider extends ContentProvider {
|
|||
return;
|
||||
}
|
||||
|
||||
String[] values = new String[len];
|
||||
if (nameIndex >= 0) {
|
||||
values[nameIndex] = name;
|
||||
}
|
||||
if (pathIndex >= 0) {
|
||||
values[pathIndex] = path;
|
||||
}
|
||||
cursor.addRow(profileValues(name, path, len, nameIndex, pathIndex));
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class PromptListItem {
|
|||
}
|
||||
|
||||
int length = items.length();
|
||||
List<PromptListItem> list = new ArrayList<PromptListItem>(length);
|
||||
List<PromptListItem> list = new ArrayList<>(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
try {
|
||||
PromptListItem item = new PromptListItem(items.getJSONObject(i));
|
||||
|
@ -115,8 +115,6 @@ public class PromptListItem {
|
|||
} catch(Exception ex) { }
|
||||
}
|
||||
|
||||
PromptListItem[] arrays = new PromptListItem[length];
|
||||
list.toArray(arrays);
|
||||
return arrays;
|
||||
return list.toArray(new PromptListItem[length]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,16 +122,12 @@ public class AndroidBrowserHistoryDataAccessor extends
|
|||
|
||||
int size = records.size();
|
||||
ContentValues[] cvs = new ContentValues[size];
|
||||
String[] guids = new String[size];
|
||||
Map<String, Record> guidToRecord = new HashMap<String, Record>();
|
||||
int index = 0;
|
||||
for (Record record : records) {
|
||||
if (record.guid == null) {
|
||||
throw new IllegalArgumentException("Record with null GUID passed in to bulkInsert.");
|
||||
}
|
||||
cvs[index] = getContentValues(record);
|
||||
guids[index] = record.guid;
|
||||
guidToRecord.put(record.guid, record);
|
||||
index += 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,6 @@ public abstract class AndroidBrowserRepositoryDataAccessor {
|
|||
// re-allocate in the (rare) error case and maintain a fast path for the
|
||||
// success case.
|
||||
size = index;
|
||||
ContentValues[] temp = new ContentValues[size];
|
||||
System.arraycopy(cvs, 0, temp, 0, size); // No java.util.Arrays.copyOf in older Android SDKs.
|
||||
}
|
||||
|
||||
int inserted = context.getContentResolver().bulkInsert(getUri(), cvs);
|
||||
|
|
Загрузка…
Ссылка в новой задаче