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

Unified Diff: chrome/common/thumbnail_score.h

Issue 6389001: Add heuristics to skip thumbnail generation when it's unnecessary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor cleanup Created 9 years, 11 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
Index: chrome/common/thumbnail_score.h
diff --git a/chrome/common/thumbnail_score.h b/chrome/common/thumbnail_score.h
index 30bcf8fb6049b538e7cdd02a3fbb72038a93e94a..ee32cad415d73c30d1505cb995172f0d10b97319 100644
--- a/chrome/common/thumbnail_score.h
+++ b/chrome/common/thumbnail_score.h
@@ -6,6 +6,7 @@
#define CHROME_COMMON_THUMBNAIL_SCORE_H_
#pragma once
+#include <string>
#include "base/time.h"
// A set of metadata about a Thumbnail.
@@ -27,6 +28,9 @@ struct ThumbnailScore {
// Tests for equivalence between two ThumbnailScore objects.
bool Equals(const ThumbnailScore& rhs) const;
+ // Returns string representation of this object.
+ std::string ToString() const;
+
// How "boring" a thumbnail is. The boring score is the 0,1 ranged
// percentage of pixels that are the most common luma. Higher boring
// scores indicate that a higher percentage of a bitmap are all the
@@ -67,6 +71,10 @@ struct ThumbnailScore {
// How bad a thumbnail needs to be before we completely ignore it.
static const double kThumbnailMaximumBoringness;
+ // We consider a thumbnail interesting enough if the boring score is
+ // lower than this.
+ static const double kThumbnailInterestingEnoughBoringness;
+
// Time before we take a worse thumbnail (subject to
// kThumbnailMaximumBoringness) over what's currently in the database
// for freshness.
@@ -80,4 +88,9 @@ struct ThumbnailScore {
bool ShouldReplaceThumbnailWith(const ThumbnailScore& current,
const ThumbnailScore& replacement);
+// Checks whether we should generate a new thumbnail. For instance, we
+// don't have to generaet a new thumbnail if the current thumbnail is new
+// and interesting enough.
+bool ShouldGenerateThumbnail(const ThumbnailScore& current);
brettw 2011/01/26 05:55:20 Can you move this to the ThumbnailScore class? The
satorux1 2011/01/26 08:14:46 Agreed. Changed accordingly. Chose ShouldConsiderU
+
#endif // CHROME_COMMON_THUMBNAIL_SCORE_H_

Powered by Google App Engine
This is Rietveld 408576698