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

Unified Diff: ios/chrome/browser/reading_list/reading_list_model_impl.cc

Issue 2350663003: Make reading list entry movable only (Closed)
Patch Set: indentation Created 4 years, 3 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: ios/chrome/browser/reading_list/reading_list_model_impl.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_model_impl.cc b/ios/chrome/browser/reading_list/reading_list_model_impl.cc
index 48235ee5d6d889795882f9f012c55ed93ece85b7..6059c11eea3c99012e2f90fc68cc9a528b38eacb 100644
--- a/ios/chrome/browser/reading_list/reading_list_model_impl.cc
+++ b/ios/chrome/browser/reading_list/reading_list_model_impl.cc
@@ -103,10 +103,10 @@ const ReadingListEntry& ReadingListModelImpl::AddEntry(
const std::string& title) {
DCHECK(loaded());
RemoveEntryByUrl(url);
- const ReadingListEntry entry(url, title);
+ ReadingListEntry entry(url, title);
FOR_EACH_OBSERVER(ReadingListModelObserver, observers_,
ReadingListWillAddUnreadEntry(this, entry));
- unread_.insert(unread_.begin(), entry);
+ unread_.insert(unread_.begin(), std::move(entry));
hasUnseen_ = true;
if (storageLayer_ && !IsPerformingBatchUpdates()) {
storageLayer_->SavePersistentUnreadList(unread_);
@@ -119,8 +119,7 @@ const ReadingListEntry& ReadingListModelImpl::AddEntry(
void ReadingListModelImpl::MarkReadByURL(const GURL& url) {
DCHECK(loaded());
- const ReadingListEntry entry(url, std::string());
-
+ ReadingListEntry entry(url, std::string());
auto result = std::find(unread_.begin(), unread_.end(), entry);
if (result == unread_.end())
return;
@@ -129,8 +128,9 @@ void ReadingListModelImpl::MarkReadByURL(const GURL& url) {
ReadingListModelObserver, observers_,
ReadingListWillMoveEntry(this, std::distance(unread_.begin(), result)));
- read_.insert(read_.begin(), *result);
+ read_.insert(read_.begin(), std::move(*result));
unread_.erase(result);
+
if (storageLayer_ && !IsPerformingBatchUpdates()) {
storageLayer_->SavePersistentUnreadList(unread_);
storageLayer_->SavePersistentReadList(read_);

Powered by Google App Engine
This is Rietveld 408576698