Bug 404370 - perf: Don't call AdjustIndices when inserting a bookmark at the default index. r=sspitzer. a=mconnor.

This commit is contained in:
mozilla.mano%sent.com 2007-11-20 01:14:28 +00:00
Родитель 64a70711bf
Коммит 0e829fc2a0
1 изменённых файлов: 26 добавлений и 12 удалений

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

@ -935,10 +935,14 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex,
nsresult rv = History()->GetUrlIdFor(aItem, &childID, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 index = (aIndex == -1) ? FolderCount(aFolder) : aIndex;
rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 index;
if (aIndex == nsINavBookmarksService::DEFAULT_INDEX) {
index = FolderCount(aFolder);
} else {
index = aIndex;
rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
}
mozStorageStatementScoper scope(mDBInsertBookmark);
rv = mDBInsertBookmark->BindInt64Parameter(0, childID);
@ -1109,10 +1113,15 @@ nsNavBookmarks::CreateContainerWithID(PRInt64 aItemId, PRInt64 aParent,
mozIStorageConnection *dbConn = DBConn();
mozStorageTransaction transaction(dbConn, PR_FALSE);
PRInt32 index = (*aIndex == -1) ? FolderCount(aParent) : *aIndex;
nsresult rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 index;
nsresult rv;
if (*aIndex == nsINavBookmarksService::DEFAULT_INDEX) {
index = FolderCount(aParent);
} else {
index = *aIndex;
rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<mozIStorageStatement> statement;
if (aItemId == -1) {
@ -1179,10 +1188,15 @@ nsNavBookmarks::InsertSeparator(PRInt64 aParent, PRInt32 aIndex,
mozIStorageConnection *dbConn = DBConn();
mozStorageTransaction transaction(dbConn, PR_FALSE);
PRInt32 index = (aIndex == -1) ? FolderCount(aParent) : aIndex;
nsresult rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 index;
nsresult rv;
if (aIndex == nsINavBookmarksService::DEFAULT_INDEX) {
index = FolderCount(aParent);
} else {
index = aIndex;
rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<mozIStorageStatement> statement;
rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("INSERT INTO moz_bookmarks "