summaryrefslogtreecommitdiffstats
path: root/chrome/common/thumbnail_score.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 04:02:39 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 04:02:39 +0000
commitd46bdac81462255501c76f5a7dcd15b736fa986f (patch)
treeef790bf7be1bdf3a490c0ec9fa2da599067626b6 /chrome/common/thumbnail_score.h
parentf3ad027e3d26994292c5564b820cd91fee977ae8 (diff)
downloadchromium_src-d46bdac81462255501c76f5a7dcd15b736fa986f.zip
chromium_src-d46bdac81462255501c76f5a7dcd15b736fa986f.tar.gz
chromium_src-d46bdac81462255501c76f5a7dcd15b736fa986f.tar.bz2
Add some initial code for the top sites service. This will be a replacement for
the thumbnail database, and will also replace the ThumbnailStore which was the previous replacement we didn't ship. This component will be very much like the ThumbnailStore wtih the addition of the actual most visited data (not just thumbnails) and that it is threadsafe. This class is designed to be called on any thread. When it is complete, thumbnails will be added to it from the UI thread of the browser. Requests for thumbnails and the most visited data can be serviced directly on the I/O thread without going through the UI thread, and since the data is cached, the request won't also have to go through the history thread. The current state is that it cqan store and update the the most visited list and thumbnails. There are unit tests covering this behavior. I also added support for redirect ranking to ThumbnailScore. This is to duplicated the ranking function in history currently, where it prefers thumbnails closer to the end of a redirect chain. Since we won't be using the history service and are only storing thumbnails for the most visited items, we have to track the redirect index ourselves. BUG=none TEST=covered by unit tests (hopefully!) Review URL: http://codereview.chromium.org/251002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/thumbnail_score.h')
-rw-r--r--chrome/common/thumbnail_score.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/chrome/common/thumbnail_score.h b/chrome/common/thumbnail_score.h
index 530f87e..c1ebb81 100644
--- a/chrome/common/thumbnail_score.h
+++ b/chrome/common/thumbnail_score.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,8 +9,9 @@
// A set of metadata about a Thumbnail.
struct ThumbnailScore {
- // Initializes the ThumbnailScore to the absolute worst possible
- // values except for time, which is set to Now().
+ // Initializes the ThumbnailScore to the absolute worst possible values
+ // except for time, which is set to Now(), and redirect_hops_from_dest which
+ // is set to 0.
ThumbnailScore();
// Builds a ThumbnailScore with the passed in values, and sets the
@@ -48,6 +49,20 @@ struct ThumbnailScore {
// sure thumbnails are kept fresh.
base::Time time_at_snapshot;
+ // The number of hops from the final destination page that this thumbnail was
+ // taken at. When a thumbnail is taken, this will always be the redirect
+ // destination (value of 0).
+ //
+ // For the most visited view, we'll sometimes get thumbnails for URLs in the
+ // middle of a redirect chain. In this case, the top sites component will set
+ // this value so the distance from the destination can be taken into account
+ // by the comparison function.
+ //
+ // If "http://google.com/" redirected to "http://www.google.com/", then
+ // a thumbnail for the first would have a redirect hop of 1, and the second
+ // would have a redirect hop of 0.
+ int redirect_hops_from_dest;
+
// How bad a thumbnail needs to be before we completely ignore it.
static const double kThumbnailMaximumBoringness;