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

Side by Side Diff: components/bookmarks/browser/bookmark_model.cc

Issue 2883523002: Reduce the memory usage of bookmarks storage (Closed)
Patch Set: MakeUnique Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/bookmarks/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/bookmark_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 if (!icon_url.is_empty()) { 476 if (!icon_url.is_empty()) {
477 // Log Histogram to determine how often |icon_url| is non empty in 477 // Log Histogram to determine how often |icon_url| is non empty in
478 // practice. 478 // practice.
479 // TODO(pkotwicz): Do something more efficient if |icon_url| is non-empty 479 // TODO(pkotwicz): Do something more efficient if |icon_url| is non-empty
480 // many times a day for each user. 480 // many times a day for each user.
481 UMA_HISTOGRAM_BOOLEAN("Bookmarks.OnFaviconsChangedIconURL", true); 481 UMA_HISTOGRAM_BOOLEAN("Bookmarks.OnFaviconsChangedIconURL", true);
482 482
483 base::AutoLock url_lock(url_lock_); 483 base::AutoLock url_lock(url_lock_);
484 for (const BookmarkNode* node : nodes_ordered_by_url_set_) { 484 for (const BookmarkNode* node : nodes_ordered_by_url_set_) {
485 if (icon_url == node->icon_url()) 485 if (node->icon_url() && icon_url == *node->icon_url())
486 to_update.insert(node); 486 to_update.insert(node);
487 } 487 }
488 } 488 }
489 489
490 for (const BookmarkNode* node : to_update) { 490 for (const BookmarkNode* node : to_update) {
491 // Rerequest the favicon. 491 // Rerequest the favicon.
492 BookmarkNode* mutable_node = AsMutable(node); 492 BookmarkNode* mutable_node = AsMutable(node);
493 mutable_node->InvalidateFavicon(); 493 mutable_node->InvalidateFavicon();
494 CancelPendingFaviconLoadRequests(mutable_node); 494 CancelPendingFaviconLoadRequests(mutable_node);
495 for (BookmarkModelObserver& observer : observers_) 495 for (BookmarkModelObserver& observer : observers_)
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 undo_delegate_ = undo_delegate; 1123 undo_delegate_ = undo_delegate;
1124 if (undo_delegate_) 1124 if (undo_delegate_)
1125 undo_delegate_->SetUndoProvider(this); 1125 undo_delegate_->SetUndoProvider(this);
1126 } 1126 }
1127 1127
1128 BookmarkUndoDelegate* BookmarkModel::undo_delegate() const { 1128 BookmarkUndoDelegate* BookmarkModel::undo_delegate() const {
1129 return undo_delegate_ ? undo_delegate_ : empty_undo_delegate_.get(); 1129 return undo_delegate_ ? undo_delegate_ : empty_undo_delegate_.get();
1130 } 1130 }
1131 1131
1132 } // namespace bookmarks 1132 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_codec.cc ('k') | components/bookmarks/browser/bookmark_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698