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

Side by Side Diff: chrome/browser/history/top_sites.h

Issue 14273023: Rebuild test history databases when starting up performance_ui_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Speed up profile generation Created 7 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_ 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_ 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Initializes TopSites. 59 // Initializes TopSites.
60 void Init(const base::FilePath& db_name); 60 void Init(const base::FilePath& db_name);
61 61
62 // Sets the given thumbnail for the given URL. Returns true if the thumbnail 62 // Sets the given thumbnail for the given URL. Returns true if the thumbnail
63 // was updated. False means either the URL wasn't known to us, or we felt 63 // was updated. False means either the URL wasn't known to us, or we felt
64 // that our current thumbnail was superior to the given one. 64 // that our current thumbnail was superior to the given one.
65 bool SetPageThumbnail(const GURL& url, 65 bool SetPageThumbnail(const GURL& url,
66 const gfx::Image& thumbnail, 66 const gfx::Image& thumbnail,
67 const ThumbnailScore& score); 67 const ThumbnailScore& score);
68 68
69 // While testing the history system, we want to set the thumbnail to a piece
70 // of static memory.
71 bool SetPageThumbnailToJPEGBytes(
72 const GURL& url,
73 const base::RefCountedMemory* memory,
74 const ThumbnailScore& score);
75
69 typedef base::Callback<void(const MostVisitedURLList&)> 76 typedef base::Callback<void(const MostVisitedURLList&)>
70 GetMostVisitedURLsCallback; 77 GetMostVisitedURLsCallback;
71 typedef std::vector<GetMostVisitedURLsCallback> PendingCallbacks; 78 typedef std::vector<GetMostVisitedURLsCallback> PendingCallbacks;
72 79
73 // Returns a list of most visited URLs via a callback. This may be invoked on 80 // Returns a list of most visited URLs via a callback. This may be invoked on
74 // any thread. 81 // any thread.
75 // NOTE: the callback is called immediately if we have the data cached. If 82 // NOTE: the callback is called immediately if we have the data cached. If
76 // data is not available yet, callback will later be posted to the thread 83 // data is not available yet, callback will later be posted to the thread
77 // called this function. 84 // called this function.
78 void GetMostVisitedURLs(const GetMostVisitedURLsCallback& callback); 85 void GetMostVisitedURLs(const GetMostVisitedURLsCallback& callback);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 TOP_SITES_LOADED_WAITING_FOR_HISTORY, 216 TOP_SITES_LOADED_WAITING_FOR_HISTORY,
210 217
211 // Top sites is loaded. 218 // Top sites is loaded.
212 TOP_SITES_LOADED 219 TOP_SITES_LOADED
213 }; 220 };
214 221
215 // Sets the thumbnail without writing to the database. Useful when 222 // Sets the thumbnail without writing to the database. Useful when
216 // reading last known top sites from the DB. 223 // reading last known top sites from the DB.
217 // Returns true if the thumbnail was set, false if the existing one is better. 224 // Returns true if the thumbnail was set, false if the existing one is better.
218 bool SetPageThumbnailNoDB(const GURL& url, 225 bool SetPageThumbnailNoDB(const GURL& url,
219 const base::RefCountedBytes* thumbnail_data, 226 const base::RefCountedMemory* thumbnail_data,
220 const ThumbnailScore& score); 227 const ThumbnailScore& score);
221 228
222 // A version of SetPageThumbnail that takes RefCountedBytes as 229 // A version of SetPageThumbnail that takes RefCountedMemory as
223 // returned by HistoryService. 230 // returned by HistoryService.
224 bool SetPageThumbnailEncoded(const GURL& url, 231 bool SetPageThumbnailEncoded(const GURL& url,
225 const base::RefCountedBytes* thumbnail, 232 const base::RefCountedMemory* thumbnail,
226 const ThumbnailScore& score); 233 const ThumbnailScore& score);
227 234
228 // Encodes the bitmap to bytes for storage to the db. Returns true if the 235 // Encodes the bitmap to bytes for storage to the db. Returns true if the
229 // bitmap was successfully encoded. 236 // bitmap was successfully encoded.
230 static bool EncodeBitmap(const gfx::Image& bitmap, 237 static bool EncodeBitmap(const gfx::Image& bitmap,
231 scoped_refptr<base::RefCountedBytes>* bytes); 238 scoped_refptr<base::RefCountedBytes>* bytes);
232 239
233 // Removes the cached thumbnail for url. Does nothing if |url| if not cached 240 // Removes the cached thumbnail for url. Does nothing if |url| if not cached
234 // in |temp_images_|. 241 // in |temp_images_|.
235 void RemoveTemporaryThumbnailByURL(const GURL& url); 242 void RemoveTemporaryThumbnailByURL(const GURL& url);
236 243
237 // Add a thumbnail for an unknown url. See temp_thumbnails_map_. 244 // Add a thumbnail for an unknown url. See temp_thumbnails_map_.
238 void AddTemporaryThumbnail(const GURL& url, 245 void AddTemporaryThumbnail(const GURL& url,
239 const base::RefCountedBytes* thumbnail, 246 const base::RefCountedMemory* thumbnail,
240 const ThumbnailScore& score); 247 const ThumbnailScore& score);
241 248
242 // Called by our timer. Starts the query for the most visited sites. 249 // Called by our timer. Starts the query for the most visited sites.
243 void TimerFired(); 250 void TimerFired();
244 251
245 // Finds the given URL in the redirect chain for the given TopSite, and 252 // Finds the given URL in the redirect chain for the given TopSite, and
246 // returns the distance from the destination in hops that the given URL is. 253 // returns the distance from the destination in hops that the given URL is.
247 // The URL is assumed to be in the list. The destination is 0. 254 // The URL is assumed to be in the list. The destination is 0.
248 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited, 255 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited,
249 const GURL& url); 256 const GURL& url);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 370
364 #if defined(OS_ANDROID) 371 #if defined(OS_ANDROID)
365 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; 372 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1];
366 #else 373 #else
367 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; 374 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2];
368 #endif 375 #endif
369 376
370 } // namespace history 377 } // namespace history
371 378
372 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ 379 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698