Bug 1343726 - Ensure that bookmark folders are processed first by the uploader r=rnewman

Since we're uploading records atomically, order in which they're processed by the uploader
only matters if we want to do sanity checks on certain types of records. Server might still
preserve some of the order, but for our purposes here it shouldn't matter.

We'd like to ensure that we process the "mobile root" bookmark record along with other folder
records first, so that we increase our chances of avoiding making a failing network request if
that those records' payload is too large.

Sorting by bookmark type achieves this.

MozReview-Commit-ID: KrAs3zepaOk

--HG--
extra : rebase_source : 24f1d3d6aa2ee3b6777dc38abdd1e01aba5213c2
This commit is contained in:
Grigory Kruglov 2017-03-15 14:12:13 -07:00
Родитель b7266cbba2
Коммит 2a7dc44081
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -75,6 +75,18 @@ public class AndroidBrowserBookmarksDataAccessor extends AndroidBrowserRepositor
return BrowserContractHelpers.BOOKMARKS_CONTENT_URI; return BrowserContractHelpers.BOOKMARKS_CONTENT_URI;
} }
/**
* Order bookmarks by type, ensuring that folders will be processed before other records during
* an upload. This is in support of payload-size validation. See Bug 1343726.
*/
@Override
public Cursor fetchSince(long timestamp) throws NullCursorException {
return queryHelper.safeQuery(".fetchSince",
getAllColumns(),
dateModifiedWhere(timestamp),
null, BrowserContract.Bookmarks.TYPE + " ASC");
}
protected static Uri getPositionsUri() { protected static Uri getPositionsUri() {
return BrowserContractHelpers.BOOKMARKS_POSITIONS_CONTENT_URI; return BrowserContractHelpers.BOOKMARKS_POSITIONS_CONTENT_URI;
} }