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

Side by Side Diff: chrome/browser/sync/glue/bookmark_change_processor.cc

Issue 661883002: Sync: Optimize FavIcon callbacks from bookmark model. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Limit the change to the FavIcon check in BookmarkChangeProcessor::BookmarkNodeFaviconChanged Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/sync/glue/bookmark_change_processor.h" 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h"
6 6
7 #include <map> 7 #include <map>
8 #include <stack> 8 #include <stack>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 } 403 }
404 404
405 UpdateTransactionVersion(new_version, model, 405 UpdateTransactionVersion(new_version, model,
406 std::vector<const BookmarkNode*>(1, child)); 406 std::vector<const BookmarkNode*>(1, child));
407 } 407 }
408 408
409 void BookmarkChangeProcessor::BookmarkNodeFaviconChanged( 409 void BookmarkChangeProcessor::BookmarkNodeFaviconChanged(
410 BookmarkModel* model, 410 BookmarkModel* model,
411 const BookmarkNode* node) { 411 const BookmarkNode* node) {
412 if (!CanSyncNode(node)) {
413 return;
414 }
415
416 // We shouldn't see changes to the top-level nodes.
417 if (model->is_permanent_node(node)) {
418 NOTREACHED() << "Saw Favicon update to permanent node!";
419 return;
420 }
421
422 // Ignore changes with empty images. This can happen if the favicon is
423 // still being loaded.
424 const gfx::Image& favicon = model->GetFavicon(node);
425 if (favicon.IsEmpty()) {
426 return;
427 }
428
412 BookmarkNodeChanged(model, node); 429 BookmarkNodeChanged(model, node);
413 } 430 }
414 431
415 void BookmarkChangeProcessor::BookmarkNodeChildrenReordered( 432 void BookmarkChangeProcessor::BookmarkNodeChildrenReordered(
416 BookmarkModel* model, const BookmarkNode* node) { 433 BookmarkModel* model, const BookmarkNode* node) {
417 if (!CanSyncNode(node)) 434 if (!CanSyncNode(node))
418 return; 435 return;
419 int64 new_version = syncer::syncable::kInvalidTransactionVersion; 436 int64 new_version = syncer::syncable::kInvalidTransactionVersion;
420 std::vector<const BookmarkNode*> children; 437 std::vector<const BookmarkNode*> children;
421 { 438 {
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); 904 updated_specifics.set_icon_url(bookmark_node->icon_url().spec());
888 sync_node->SetBookmarkSpecifics(updated_specifics); 905 sync_node->SetBookmarkSpecifics(updated_specifics);
889 } 906 }
890 } 907 }
891 908
892 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { 909 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) {
893 return bookmark_model_->client()->CanSyncNode(node); 910 return bookmark_model_->client()->CanSyncNode(node);
894 } 911 }
895 912
896 } // namespace browser_sync 913 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698