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

Unified Diff: chrome/browser/history/top_sites.h

Issue 4106014: Tweaks to improve memory consumption by TopSites. The biggest culprit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 10 years, 2 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
« no previous file with comments | « chrome/browser/history/thumbnail_database.cc ('k') | chrome/browser/history/top_sites.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites.h
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h
index cc70cc7d6360431ca6ddc3bc1ed4bfc5d99efd43..bd406f10a9f164847396d6342d397cdffdb567e4 100644
--- a/chrome/browser/history/top_sites.h
+++ b/chrome/browser/history/top_sites.h
@@ -6,14 +6,14 @@
#define CHROME_BROWSER_HISTORY_TOP_SITES_H_
#pragma once
-#include <map>
+#include <list>
#include <set>
#include <string>
-#include <vector>
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/lock.h"
+#include "base/time.h"
#include "base/timer.h"
#include "base/ref_counted.h"
#include "base/ref_counted_memory.h"
@@ -145,6 +145,9 @@ class TopSites
friend class base::RefCountedThreadSafe<TopSites>;
friend class TopSitesTest;
+ typedef std::pair<GURL, Images> TempImage;
+ typedef std::list<TempImage> TempImages;
+
// Enumeration of the possible states history can be in.
enum HistoryLoadState {
// We're waiting for history to finish loading.
@@ -191,6 +194,10 @@ class TopSites
static bool EncodeBitmap(const SkBitmap& bitmap,
scoped_refptr<RefCountedBytes>* bytes);
+ // Removes the cached thumbnail for url. Does nothing if |url| if not cached
+ // in |temp_images_|.
+ void RemoveTemporaryThumbnailByURL(const GURL& url);
+
// Add a thumbnail for an unknown url. See temp_thumbnails_map_.
void AddTemporaryThumbnail(const GURL& url,
const RefCountedBytes* thumbnail,
@@ -295,6 +302,9 @@ class TopSites
// data stays in sync with history.
base::OneShotTimer<TopSites> timer_;
+ // The time we started |timer_| at. Only valid if |timer_| is running.
+ base::TimeTicks timer_start_time_;
+
NotificationRegistrar registrar_;
// The number of URLs changed on the last update.
@@ -309,7 +319,7 @@ class TopSites
// called, if we don't know about that URL yet and we don't have
// enough Top Sites (new profile), we store it until the next
// SetTopSites call.
- URLToImagesMap temp_thumbnails_map_;
+ TempImages temp_images_;
// Blacklisted and pinned URLs are stored in Preferences.
« no previous file with comments | « chrome/browser/history/thumbnail_database.cc ('k') | chrome/browser/history/top_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698