Index: third_party/WebKit/WebCore/history/HistoryItem.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/history/HistoryItem.cpp (revision 9383) |
+++ third_party/WebKit/WebCore/history/HistoryItem.cpp (working copy) |
@@ -74,7 +74,7 @@ |
, m_lastVisitWasFailure(false) |
, m_isTargetItem(false) |
, m_visitCount(0) |
-{ |
+{ |
iconDatabase()->retainIconForPageURL(m_urlString); |
} |
@@ -114,8 +114,6 @@ |
, m_lastVisitWasFailure(item.m_lastVisitWasFailure) |
, m_isTargetItem(item.m_isTargetItem) |
, m_visitCount(item.m_visitCount) |
- , m_dailyVisitCounts(item.m_dailyVisitCounts) |
- , m_weeklyVisitCounts(item.m_weeklyVisitCounts) |
, m_formContentType(item.m_formContentType) |
{ |
ASSERT(!item.m_cachedPage); |
@@ -248,93 +246,31 @@ |
m_parent = parent; |
} |
-static inline int timeToDay(double time) |
+void HistoryItem::setLastVisitedTime(double time) |
{ |
- static const double secondsPerDay = 60 * 60 * 24; |
- return static_cast<int>(ceil(time / secondsPerDay)); |
-} |
- |
-void HistoryItem::padDailyCountsForNewVisit(double time) |
-{ |
- if (m_dailyVisitCounts.isEmpty()) |
- m_dailyVisitCounts.prepend(m_visitCount); |
- |
- int daysElapsed = timeToDay(time) - timeToDay(m_lastVisitedTime); |
- |
- if (daysElapsed < 0) |
- daysElapsed = 0; |
- |
- Vector<int> padding; |
- padding.fill(0, daysElapsed); |
- m_dailyVisitCounts.prepend(padding); |
-} |
- |
-static const size_t daysPerWeek = 7; |
-static const size_t maxDailyCounts = 2 * daysPerWeek - 1; |
-static const size_t maxWeeklyCounts = 5; |
- |
-void HistoryItem::collapseDailyVisitsToWeekly() |
-{ |
- while (m_dailyVisitCounts.size() > maxDailyCounts) { |
- int oldestWeekTotal = 0; |
- for (size_t i = 0; i < daysPerWeek; i++) |
- oldestWeekTotal += m_dailyVisitCounts[m_dailyVisitCounts.size() - daysPerWeek + i]; |
- m_dailyVisitCounts.shrink(m_dailyVisitCounts.size() - daysPerWeek); |
- m_weeklyVisitCounts.prepend(oldestWeekTotal); |
+ if (m_lastVisitedTime != time) { |
+ m_lastVisitedTime = time; |
+ m_visitCount++; |
} |
- |
- if (m_weeklyVisitCounts.size() > maxWeeklyCounts) |
- m_weeklyVisitCounts.shrink(maxWeeklyCounts); |
} |
-void HistoryItem::recordVisitAtTime(double time) |
+void HistoryItem::visited(const String& title, double time) |
{ |
- padDailyCountsForNewVisit(time); |
- |
+ m_title = title; |
m_lastVisitedTime = time; |
m_visitCount++; |
- |
- m_dailyVisitCounts[0]++; |
- |
- collapseDailyVisitsToWeekly(); |
} |
-void HistoryItem::setLastVisitedTime(double time) |
-{ |
- if (m_lastVisitedTime != time) |
- recordVisitAtTime(time); |
-} |
- |
-void HistoryItem::visited(const String& title, double time) |
-{ |
- m_title = title; |
- recordVisitAtTime(time); |
-} |
- |
int HistoryItem::visitCount() const |
{ |
return m_visitCount; |
} |
-void HistoryItem::recordInitialVisit() |
-{ |
- ASSERT(!m_visitCount); |
- recordVisitAtTime(m_lastVisitedTime); |
-} |
- |
void HistoryItem::setVisitCount(int count) |
{ |
m_visitCount = count; |
} |
-void HistoryItem::adoptVisitCounts(Vector<int>& dailyCounts, Vector<int>& weeklyCounts) |
-{ |
- m_dailyVisitCounts.clear(); |
- m_dailyVisitCounts.swap(dailyCounts); |
- m_weeklyVisitCounts.clear(); |
- m_weeklyVisitCounts.swap(weeklyCounts); |
-} |
- |
const IntPoint& HistoryItem::scrollPoint() const |
{ |
return m_scrollPoint; |
@@ -459,9 +395,6 @@ |
void HistoryItem::mergeAutoCompleteHints(HistoryItem* otherItem) |
{ |
- // FIXME: this is broken - we should be merging the daily counts |
- // somehow. but this is to support API that's not really used in |
- // practice so leave it broken for now. |
ASSERT(otherItem); |
if (otherItem != this) |
m_visitCount += otherItem->m_visitCount; |