OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
6 #define COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ | 6 #define COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include "base/time/time.h" | 11 #include "base/time/time.h" |
10 | 12 |
11 // A set of metadata about a Thumbnail. | 13 // A set of metadata about a Thumbnail. |
12 struct ThumbnailScore { | 14 struct ThumbnailScore { |
13 // Initializes the ThumbnailScore to the absolute worst possible values | 15 // Initializes the ThumbnailScore to the absolute worst possible values |
14 // except for time, which is set to Now(), and redirect_hops_from_dest which | 16 // except for time, which is set to Now(), and redirect_hops_from_dest which |
15 // is set to 0. | 17 // is set to 0. |
16 ThumbnailScore(); | 18 ThumbnailScore(); |
17 | 19 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // How bad a thumbnail needs to be before we completely ignore it. | 84 // How bad a thumbnail needs to be before we completely ignore it. |
83 static const double kThumbnailMaximumBoringness; | 85 static const double kThumbnailMaximumBoringness; |
84 | 86 |
85 // We consider a thumbnail interesting enough if the boring score is | 87 // We consider a thumbnail interesting enough if the boring score is |
86 // lower than this. | 88 // lower than this. |
87 static const double kThumbnailInterestingEnoughBoringness; | 89 static const double kThumbnailInterestingEnoughBoringness; |
88 | 90 |
89 // Time before we take a worse thumbnail (subject to | 91 // Time before we take a worse thumbnail (subject to |
90 // kThumbnailMaximumBoringness) over what's currently in the database | 92 // kThumbnailMaximumBoringness) over what's currently in the database |
91 // for freshness. | 93 // for freshness. |
92 static const int64 kUpdateThumbnailTimeDays; | 94 static const int64_t kUpdateThumbnailTimeDays; |
93 | 95 |
94 // Penalty of how much more boring a thumbnail should be per hour. | 96 // Penalty of how much more boring a thumbnail should be per hour. |
95 static const double kThumbnailDegradePerHour; | 97 static const double kThumbnailDegradePerHour; |
96 | 98 |
97 // If a thumbnail is taken with the aspect ratio greater than or equal to | 99 // If a thumbnail is taken with the aspect ratio greater than or equal to |
98 // this value, |good_clipping| is to false. | 100 // this value, |good_clipping| is to false. |
99 static const double kTooWideAspectRatio; | 101 static const double kTooWideAspectRatio; |
100 | 102 |
101 // Checks whether we should consider updating a new thumbnail based on | 103 // Checks whether we should consider updating a new thumbnail based on |
102 // this score. For instance, we don't have to update a new thumbnail | 104 // this score. For instance, we don't have to update a new thumbnail |
103 // if the current thumbnail is new and interesting enough. | 105 // if the current thumbnail is new and interesting enough. |
104 bool ShouldConsiderUpdating(); | 106 bool ShouldConsiderUpdating(); |
105 }; | 107 }; |
106 | 108 |
107 // Checks whether we should replace one thumbnail with another. | 109 // Checks whether we should replace one thumbnail with another. |
108 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current, | 110 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current, |
109 const ThumbnailScore& replacement); | 111 const ThumbnailScore& replacement); |
110 | 112 |
111 #endif // COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ | 113 #endif // COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
OLD | NEW |