Index: chrome/browser/history/history_types.cc |
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc |
index 97d860dde08b4da7f954e959d981daefd78c4491..97145ecbad8eaf3056e23c79ea0256f8aa6eb69f 100644 |
--- a/chrome/browser/history/history_types.cc |
+++ b/chrome/browser/history/history_types.cc |
@@ -8,7 +8,6 @@ |
#include "base/logging.h" |
#include "base/stl_util.h" |
-#include "chrome/browser/history/page_usage_data.h" |
namespace history { |
@@ -38,145 +37,6 @@ VisitRow::VisitRow(URLID arg_url_id, |
VisitRow::~VisitRow() { |
} |
-// QueryResults ---------------------------------------------------------------- |
- |
-QueryResults::QueryResults() : reached_beginning_(false) { |
-} |
- |
-QueryResults::~QueryResults() {} |
- |
-const size_t* QueryResults::MatchesForURL(const GURL& url, |
- size_t* num_matches) const { |
- URLToResultIndices::const_iterator found = url_to_results_.find(url); |
- if (found == url_to_results_.end()) { |
- if (num_matches) |
- *num_matches = 0; |
- return NULL; |
- } |
- |
- // All entries in the map should have at least one index, otherwise it |
- // shouldn't be in the map. |
- DCHECK(!found->second->empty()); |
- if (num_matches) |
- *num_matches = found->second->size(); |
- return &found->second->front(); |
-} |
- |
-void QueryResults::Swap(QueryResults* other) { |
- std::swap(first_time_searched_, other->first_time_searched_); |
- std::swap(reached_beginning_, other->reached_beginning_); |
- results_.swap(other->results_); |
- url_to_results_.swap(other->url_to_results_); |
-} |
- |
-void QueryResults::AppendURLBySwapping(URLResult* result) { |
- URLResult* new_result = new URLResult; |
- new_result->SwapResult(result); |
- |
- results_.push_back(new_result); |
- AddURLUsageAtIndex(new_result->url(), results_.size() - 1); |
-} |
- |
-void QueryResults::DeleteURL(const GURL& url) { |
- // Delete all instances of this URL. We re-query each time since each |
- // mutation will cause the indices to change. |
- while (const size_t* match_indices = MatchesForURL(url, NULL)) |
- DeleteRange(*match_indices, *match_indices); |
-} |
- |
-void QueryResults::DeleteRange(size_t begin, size_t end) { |
- DCHECK(begin <= end && begin < size() && end < size()); |
- |
- // First delete the pointers in the given range and store all the URLs that |
- // were modified. We will delete references to these later. |
- std::set<GURL> urls_modified; |
- for (size_t i = begin; i <= end; i++) { |
- urls_modified.insert(results_[i]->url()); |
- } |
- |
- // Now just delete that range in the vector en masse (the STL ending is |
- // exclusive, while ours is inclusive, hence the +1). |
- results_.erase(results_.begin() + begin, results_.begin() + end + 1); |
- |
- // Delete the indicies referencing the deleted entries. |
- for (std::set<GURL>::const_iterator url = urls_modified.begin(); |
- url != urls_modified.end(); ++url) { |
- URLToResultIndices::iterator found = url_to_results_.find(*url); |
- if (found == url_to_results_.end()) { |
- NOTREACHED(); |
- continue; |
- } |
- |
- // Need a signed loop type since we do -- which may take us to -1. |
- for (int match = 0; match < static_cast<int>(found->second->size()); |
- match++) { |
- if (found->second[match] >= begin && found->second[match] <= end) { |
- // Remove this referece from the list. |
- found->second->erase(found->second->begin() + match); |
- match--; |
- } |
- } |
- |
- // Clear out an empty lists if we just made one. |
- if (found->second->empty()) |
- url_to_results_.erase(found); |
- } |
- |
- // Shift all other indices over to account for the removed ones. |
- AdjustResultMap(end + 1, std::numeric_limits<size_t>::max(), |
- -static_cast<ptrdiff_t>(end - begin + 1)); |
-} |
- |
-void QueryResults::AddURLUsageAtIndex(const GURL& url, size_t index) { |
- URLToResultIndices::iterator found = url_to_results_.find(url); |
- if (found != url_to_results_.end()) { |
- // The URL is already in the list, so we can just append the new index. |
- found->second->push_back(index); |
- return; |
- } |
- |
- // Need to add a new entry for this URL. |
- base::StackVector<size_t, 4> new_list; |
- new_list->push_back(index); |
- url_to_results_[url] = new_list; |
-} |
- |
-void QueryResults::AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta) { |
- for (URLToResultIndices::iterator i = url_to_results_.begin(); |
- i != url_to_results_.end(); ++i) { |
- for (size_t match = 0; match < i->second->size(); match++) { |
- size_t match_index = i->second[match]; |
- if (match_index >= begin && match_index <= end) |
- i->second[match] += delta; |
- } |
- } |
-} |
- |
-// QueryOptions ---------------------------------------------------------------- |
- |
-QueryOptions::QueryOptions() |
- : max_count(0), |
- duplicate_policy(QueryOptions::REMOVE_ALL_DUPLICATES) { |
-} |
- |
-void QueryOptions::SetRecentDayRange(int days_ago) { |
- end_time = base::Time::Now(); |
- begin_time = end_time - base::TimeDelta::FromDays(days_ago); |
-} |
- |
-int64 QueryOptions::EffectiveBeginTime() const { |
- return begin_time.ToInternalValue(); |
-} |
- |
-int64 QueryOptions::EffectiveEndTime() const { |
- return end_time.is_null() ? |
- std::numeric_limits<int64>::max() : end_time.ToInternalValue(); |
-} |
- |
-int QueryOptions::EffectiveMaxCount() const { |
- return max_count ? max_count : std::numeric_limits<int>::max(); |
-} |
- |
// QueryURLResult ------------------------------------------------------------- |
QueryURLResult::QueryURLResult() : success(false) { |
@@ -185,58 +45,6 @@ QueryURLResult::QueryURLResult() : success(false) { |
QueryURLResult::~QueryURLResult() { |
} |
-// MostVisitedURL -------------------------------------------------------------- |
- |
-MostVisitedURL::MostVisitedURL() {} |
- |
-MostVisitedURL::MostVisitedURL(const GURL& url, |
- const base::string16& title) |
- : url(url), |
- title(title) { |
-} |
- |
-MostVisitedURL::MostVisitedURL(const GURL& url, |
- const base::string16& title, |
- const base::Time& last_forced_time) |
- : url(url), |
- title(title), |
- last_forced_time(last_forced_time) { |
-} |
- |
-MostVisitedURL::~MostVisitedURL() {} |
- |
-// FilteredURL ----------------------------------------------------------------- |
- |
-FilteredURL::FilteredURL() : score(0.0) {} |
- |
-FilteredURL::FilteredURL(const PageUsageData& page_data) |
- : url(page_data.GetURL()), |
- title(page_data.GetTitle()), |
- score(page_data.GetScore()) { |
-} |
- |
-FilteredURL::~FilteredURL() {} |
- |
-// FilteredURL::ExtendedInfo --------------------------------------------------- |
- |
-FilteredURL::ExtendedInfo::ExtendedInfo() |
- : total_visits(0), |
- visits(0), |
- duration_opened(0) { |
-} |
- |
-// Images --------------------------------------------------------------------- |
- |
-Images::Images() {} |
- |
-Images::~Images() {} |
- |
-// TopSitesDelta -------------------------------------------------------------- |
- |
-TopSitesDelta::TopSitesDelta() {} |
- |
-TopSitesDelta::~TopSitesDelta() {} |
- |
// HistoryAddPageArgs --------------------------------------------------------- |
HistoryAddPageArgs::HistoryAddPageArgs() |
@@ -269,56 +77,8 @@ HistoryAddPageArgs::HistoryAddPageArgs( |
HistoryAddPageArgs::~HistoryAddPageArgs() {} |
-ThumbnailMigration::ThumbnailMigration() {} |
- |
-ThumbnailMigration::~ThumbnailMigration() {} |
- |
-MostVisitedThumbnails::MostVisitedThumbnails() {} |
- |
-MostVisitedThumbnails::~MostVisitedThumbnails() {} |
- |
-// IconMapping ---------------------------------------------------------------- |
- |
-IconMapping::IconMapping() |
- : mapping_id(0), icon_id(0), icon_type(favicon_base::INVALID_ICON) {} |
- |
-IconMapping::~IconMapping() {} |
- |
-// FaviconBitmapIDSize --------------------------------------------------------- |
- |
-FaviconBitmapIDSize::FaviconBitmapIDSize() |
- : bitmap_id(0) { |
-} |
- |
-FaviconBitmapIDSize::~FaviconBitmapIDSize() { |
-} |
- |
-// FaviconBitmap -------------------------------------------------------------- |
- |
-FaviconBitmap::FaviconBitmap() |
- : bitmap_id(0), |
- icon_id(0) { |
-} |
- |
-FaviconBitmap::~FaviconBitmap() { |
-} |
- |
// VisitDatabaseObserver ------------------------------------------------------- |
VisitDatabaseObserver::~VisitDatabaseObserver() {} |
-ExpireHistoryArgs::ExpireHistoryArgs() { |
-} |
- |
-ExpireHistoryArgs::~ExpireHistoryArgs() { |
-} |
- |
-void ExpireHistoryArgs::SetTimeRangeForOneDay(base::Time time) { |
- begin_time = time.LocalMidnight(); |
- |
- // Due to DST, leap seconds, etc., the next day at midnight may be more than |
- // 24 hours away, so add 36 hours and round back down to midnight. |
- end_time = (begin_time + base::TimeDelta::FromHours(36)).LocalMidnight(); |
-} |
- |
} // namespace history |