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

Side by Side Diff: chrome/browser/sync/test/integration/bookmarks_helper.cc

Issue 2883523002: Reduce the memory usage of bookmarks storage (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/test/integration/bookmarks_helper.h" 5 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 gfx::Image image; 216 gfx::Image image;
217 GURL icon_url; 217 GURL icon_url;
218 }; 218 };
219 219
220 // Gets the favicon and icon URL associated with |node| in |model|. 220 // Gets the favicon and icon URL associated with |node| in |model|.
221 FaviconData GetFaviconData(BookmarkModel* model, 221 FaviconData GetFaviconData(BookmarkModel* model,
222 const BookmarkNode* node) { 222 const BookmarkNode* node) {
223 // If a favicon wasn't explicitly set for a particular URL, simply return its 223 // If a favicon wasn't explicitly set for a particular URL, simply return its
224 // blank favicon. 224 // blank favicon.
225 if (!urls_with_favicons_ || 225 if (!urls_with_favicons_ || !node->icon_url() ||
226 urls_with_favicons_->find(node->url()) == urls_with_favicons_->end()) { 226 urls_with_favicons_->find(node->url()) == urls_with_favicons_->end()) {
227 return FaviconData(); 227 return FaviconData();
228 } 228 }
229 // If a favicon was explicitly set, we may need to wait for it to be loaded 229 // If a favicon was explicitly set, we may need to wait for it to be loaded
230 // via BookmarkModel::GetFavicon(), which is an asynchronous operation. 230 // via BookmarkModel::GetFavicon(), which is an asynchronous operation.
231 if (!node->is_favicon_loaded()) { 231 if (!node->is_favicon_loaded()) {
232 FaviconChangeObserver observer(model, node); 232 FaviconChangeObserver observer(model, node);
233 model->GetFavicon(node); 233 model->GetFavicon(node);
234 observer.WaitForGetFavicon(); 234 observer.WaitForGetFavicon();
235 } 235 }
236 return FaviconData(model->GetFavicon(node), node->icon_url()); 236 return FaviconData(model->GetFavicon(node), *node->icon_url());
237 } 237 }
238 238
239 // Sets the favicon for |profile| and |node|. |profile| may be 239 // Sets the favicon for |profile| and |node|. |profile| may be
240 // |test()->verifier()|. 240 // |test()->verifier()|.
241 void SetFaviconImpl(Profile* profile, 241 void SetFaviconImpl(Profile* profile,
242 const BookmarkNode* node, 242 const BookmarkNode* node,
243 const GURL& icon_url, 243 const GURL& icon_url,
244 const gfx::Image& image, 244 const gfx::Image& image,
245 bookmarks_helper::FaviconSource favicon_source) { 245 bookmarks_helper::FaviconSource favicon_source) {
246 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile); 246 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile);
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 } // namespace 953 } // namespace
954 954
955 BookmarksUrlChecker::BookmarksUrlChecker(int profile, 955 BookmarksUrlChecker::BookmarksUrlChecker(int profile,
956 const GURL& url, 956 const GURL& url,
957 int expected_count) 957 int expected_count)
958 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, 958 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch,
959 profile, 959 profile,
960 base::ConstRef(url), 960 base::ConstRef(url),
961 expected_count), 961 expected_count),
962 "Bookmark URL counts match.") {} 962 "Bookmark URL counts match.") {}
OLDNEW
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_codec.cc » ('j') | components/bookmarks/browser/bookmark_codec.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698