Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: components/bookmarks/browser/bookmark_utils.cc

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/bookmarks/browser/bookmark_utils.cc
diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc
index 91385911ae8d1d84b041ac43a0b7e416e918681c..28690f273777331c92a28110030cc415c3c8deb9 100644
--- a/components/bookmarks/browser/bookmark_utils.cc
+++ b/components/bookmarks/browser/bookmark_utils.cc
@@ -247,7 +247,7 @@ void CopyToClipboard(BookmarkModel* model,
for (size_t i = 0; i < filtered_nodes.size(); ++i) {
int index = filtered_nodes[i]->parent()->GetIndexOf(filtered_nodes[i]);
if (index > -1)
- model->Remove(filtered_nodes[i]->parent(), index);
+ model->Remove(filtered_nodes[i]);
}
}
}
@@ -472,8 +472,7 @@ void DeleteBookmarkFolders(BookmarkModel* model,
const BookmarkNode* node = GetBookmarkNodeByID(model, *iter);
if (!node)
continue;
- const BookmarkNode* parent = node->parent();
- model->Remove(parent, parent->GetIndexOf(node));
+ model->Remove(node);
}
}
@@ -496,7 +495,7 @@ void RemoveAllBookmarks(BookmarkModel* model, const GURL& url) {
const BookmarkNode* node = bookmarks[i];
int index = node->parent()->GetIndexOf(node);
if (index > -1 && model->client()->CanBeEditedByUser(node))
- model->Remove(node->parent(), index);
+ model->Remove(node);
}
}
« no previous file with comments | « components/bookmarks/browser/bookmark_model_unittest.cc ('k') | components/bookmarks/managed/managed_bookmarks_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698