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

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

Issue 10915092: Update thumbnail_database to store times using ToInternalValue() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/browser/history/thumbnail_database_unittest.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 at_top(top), 55 at_top(top),
56 load_completed(false), 56 load_completed(false),
57 time_at_snapshot(time), 57 time_at_snapshot(time),
58 redirect_hops_from_dest(0) { 58 redirect_hops_from_dest(0) {
59 } 59 }
60 60
61 ThumbnailScore::~ThumbnailScore() { 61 ThumbnailScore::~ThumbnailScore() {
62 } 62 }
63 63
64 bool ThumbnailScore::Equals(const ThumbnailScore& rhs) const { 64 bool ThumbnailScore::Equals(const ThumbnailScore& rhs) const {
65 // When testing equality we use ToTimeT() because that's the value
66 // stuck in the SQL database, so we need to test equivalence with
67 // that lower resolution.
68 return boring_score == rhs.boring_score && 65 return boring_score == rhs.boring_score &&
69 good_clipping == rhs.good_clipping && 66 good_clipping == rhs.good_clipping &&
70 at_top == rhs.at_top && 67 at_top == rhs.at_top &&
71 time_at_snapshot.ToTimeT() == rhs.time_at_snapshot.ToTimeT() && 68 time_at_snapshot == rhs.time_at_snapshot &&
72 redirect_hops_from_dest == rhs.redirect_hops_from_dest; 69 redirect_hops_from_dest == rhs.redirect_hops_from_dest;
73 } 70 }
74 71
75 std::string ThumbnailScore::ToString() const { 72 std::string ThumbnailScore::ToString() const {
76 return StringPrintf("boring_score: %f, at_top %d, good_clipping %d, " 73 return StringPrintf("boring_score: %f, at_top %d, good_clipping %d, "
77 "load_completed: %d, " 74 "load_completed: %d, "
78 "time_at_snapshot: %f, redirect_hops_from_dest: %d", 75 "time_at_snapshot: %f, redirect_hops_from_dest: %d",
79 boring_score, 76 boring_score,
80 at_top, 77 at_top,
81 good_clipping, 78 good_clipping,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 bool ThumbnailScore::ShouldConsiderUpdating() { 130 bool ThumbnailScore::ShouldConsiderUpdating() {
134 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot; 131 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot;
135 if (time_elapsed < TimeDelta::FromDays(kUpdateThumbnailTimeDays) && 132 if (time_elapsed < TimeDelta::FromDays(kUpdateThumbnailTimeDays) &&
136 good_clipping && at_top && load_completed) { 133 good_clipping && at_top && load_completed) {
137 // The current thumbnail is new and has good properties. 134 // The current thumbnail is new and has good properties.
138 return false; 135 return false;
139 } 136 }
140 // The current thumbnail should be updated. 137 // The current thumbnail should be updated.
141 return true; 138 return true;
142 } 139 }
OLDNEW
« no previous file with comments | « chrome/browser/history/thumbnail_database_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698