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

Side by Side Diff: chrome/common/thumbnail_score.cc

Issue 7839019: Remove a static initializer in thumbnail_score.o (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
« no previous file with comments | « chrome/common/thumbnail_score.h ('k') | chrome/common/thumbnail_score_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/common/thumbnail_score.h" 5 #include "chrome/common/thumbnail_score.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 9
10 using base::Time; 10 using base::Time;
11 using base::TimeDelta; 11 using base::TimeDelta;
12 12
13 const TimeDelta ThumbnailScore::kUpdateThumbnailTime = TimeDelta::FromDays(1); 13 const int64 ThumbnailScore::kUpdateThumbnailTimeDays = 1;
14 const double ThumbnailScore::kThumbnailMaximumBoringness = 0.94; 14 const double ThumbnailScore::kThumbnailMaximumBoringness = 0.94;
15 const double ThumbnailScore::kThumbnailDegradePerHour = 0.01; 15 const double ThumbnailScore::kThumbnailDegradePerHour = 0.01;
16 16
17 // Calculates a numeric score from traits about where a snapshot was 17 // Calculates a numeric score from traits about where a snapshot was
18 // taken. The lower the better. We store the raw components in the 18 // taken. The lower the better. We store the raw components in the
19 // database because I'm sure this will evolve and I don't want to break 19 // database because I'm sure this will evolve and I don't want to break
20 // databases. 20 // databases.
21 static int GetThumbnailType(const ThumbnailScore& score) { 21 static int GetThumbnailType(const ThumbnailScore& score) {
22 int type = 0; 22 int type = 0;
23 if (!score.at_top) 23 if (!score.at_top)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // If the current thumbnail doesn't meet basic boringness 125 // If the current thumbnail doesn't meet basic boringness
126 // requirements, but the replacement does, always replace the 126 // requirements, but the replacement does, always replace the
127 // current one even if we're using a worse thumbnail type. 127 // current one even if we're using a worse thumbnail type.
128 return current.boring_score >= ThumbnailScore::kThumbnailMaximumBoringness && 128 return current.boring_score >= ThumbnailScore::kThumbnailMaximumBoringness &&
129 replacement.boring_score < ThumbnailScore::kThumbnailMaximumBoringness; 129 replacement.boring_score < ThumbnailScore::kThumbnailMaximumBoringness;
130 } 130 }
131 131
132 bool ThumbnailScore::ShouldConsiderUpdating() { 132 bool ThumbnailScore::ShouldConsiderUpdating() {
133 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot; 133 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot;
134 if (time_elapsed < kUpdateThumbnailTime && 134 if (time_elapsed < TimeDelta::FromDays(kUpdateThumbnailTimeDays) &&
135 good_clipping && at_top && load_completed) { 135 good_clipping && at_top && load_completed) {
136 // The current thumbnail is new and has good properties. 136 // The current thumbnail is new and has good properties.
137 return false; 137 return false;
138 } 138 }
139 // The current thumbnail should be updated. 139 // The current thumbnail should be updated.
140 return true; 140 return true;
141 } 141 }
OLDNEW
« no previous file with comments | « chrome/common/thumbnail_score.h ('k') | chrome/common/thumbnail_score_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698