diff options
author | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 20:43:33 +0000 |
---|---|---|
committer | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 20:43:33 +0000 |
commit | e1acf6f902e50222baf99bfb492ecc38a1604975 (patch) | |
tree | 503d45705b14be7e2f1ed86c71d6064abbf90fbe /chrome/browser/history | |
parent | a2f5993e1ce940e8a8eec900abaeed02e2eee09b (diff) | |
download | chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.zip chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.gz chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.bz2 |
Move Time, TimeDelta and TimeTicks into namespace base.
Review URL: http://codereview.chromium.org/7995
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
35 files changed, 139 insertions, 87 deletions
diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc index e604e5d..0be6c10 100644 --- a/chrome/browser/history/download_database.cc +++ b/chrome/browser/history/download_database.cc @@ -12,6 +12,8 @@ #include "chrome/common/sqlite_utils.h" #include "chrome/common/sqlite_compiled_statement.h" +using base::Time; + // Download schema: // // id SQLite-generated primary key. @@ -175,4 +177,3 @@ void DownloadDatabase::SearchDownloads(std::vector<int64>* results, } } // namespace history - diff --git a/chrome/browser/history/download_database.h b/chrome/browser/history/download_database.h index d733546..fcf72f0 100644 --- a/chrome/browser/history/download_database.h +++ b/chrome/browser/history/download_database.h @@ -40,7 +40,7 @@ class DownloadDatabase { // (inclusive) and before |remove_end|. You may use null Time values // to do an unbounded delete in either direction. This function ignores // all downloads that are in progress or are waiting to be cancelled. - void RemoveDownloadsBetween(Time remove_begin, Time remove_end); + void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); // Search for downloads matching the search text. void SearchDownloads(std::vector<int64>* results, diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h index 7a8258d..61a6d83 100644 --- a/chrome/browser/history/download_types.h +++ b/chrome/browser/history/download_types.h @@ -20,7 +20,7 @@ struct DownloadCreateInfo { DownloadCreateInfo(const std::wstring& path, const std::wstring& url, - Time start_time, + base::Time start_time, int64 received_bytes, int64 total_bytes, int32 state, @@ -50,7 +50,7 @@ struct DownloadCreateInfo { // A number that should be added to the suggested path to make it unique. // 0 means no number should be appended. Not actually stored in the db. int path_uniquifier; - Time start_time; + base::Time start_time; int64 received_bytes; int64 total_bytes; int32 state; diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index fcd8f67..0944b87 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -16,6 +16,9 @@ #include "chrome/browser/history/thumbnail_database.h" #include "chrome/common/notification_types.h" +using base::Time; +using base::TimeDelta; + namespace history { namespace { diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h index d795f88..55c72c3 100644 --- a/chrome/browser/history/expire_history_backend.h +++ b/chrome/browser/history/expire_history_backend.h @@ -59,25 +59,25 @@ class ExpireHistoryBackend { // Begins periodic expiration of history older than the given threshold. This // will continue until the object is deleted. - void StartArchivingOldStuff(TimeDelta expiration_threshold); + void StartArchivingOldStuff(base::TimeDelta expiration_threshold); // Deletes everything associated with a URL. void DeleteURL(const GURL& url); // Removes all visits in the given time range, updating the URLs accordingly. - void ExpireHistoryBetween(Time begin_time, Time end_time); + void ExpireHistoryBetween(base::Time begin_time, base::Time end_time); // Archives all visits before and including the given time, updating the URLs // accordingly. This function is intended for migrating old databases // (which encompased all time) to the tiered structure and testing, and // probably isn't useful for anything else. - void ArchiveHistoryBefore(Time end_time); + void ArchiveHistoryBefore(base::Time end_time); // Returns the current time that we are archiving stuff to. This will return // the threshold in absolute time rather than a delta, so the caller should // not save it. - Time GetCurrentArchiveTime() const { - return Time::Now() - expiration_threshold_; + base::Time GetCurrentArchiveTime() const { + return base::Time::Now() - expiration_threshold_; } private: @@ -90,7 +90,7 @@ class ExpireHistoryBackend { struct DeleteDependencies { // The time range affected. These can be is_null() to be unbounded in one // or both directions. - Time begin_time, end_time; + base::Time begin_time, end_time; // ----- Filled by DeleteVisitRelatedInfo or manually if a function doesn't // call that function. ----- @@ -208,7 +208,7 @@ class ExpireHistoryBackend { // Schedules a call to DoArchiveIteration at the given time in the // future. - void ScheduleArchive(TimeDelta delay); + void ScheduleArchive(base::TimeDelta delay); // Calls ArchiveSomeOldHistory to expire some amount of old history, and // schedules another call to happen in the future. @@ -218,7 +218,7 @@ class ExpireHistoryBackend { // than |time_threshold|. The return value indicates if we think there might // be more history to expire with the current time threshold (it does not // indicate success or failure). - bool ArchiveSomeOldHistory(Time time_threshold, int max_visits); + bool ArchiveSomeOldHistory(base::Time time_threshold, int max_visits); // Tries to detect possible bad history or inconsistencies in the database // and deletes items. For example, URLs with no visits. @@ -243,7 +243,7 @@ class ExpireHistoryBackend { // The threshold for "old" history where we will automatically expire it to // the archived database. - TimeDelta expiration_threshold_; + base::TimeDelta expiration_threshold_; // The BookmarkService; may be null. This is owned by the Profile. // diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index e067894..fab52e5 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -20,6 +20,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "SkBitmap.h" +using base::Time; +using base::TimeDelta; +using base::TimeTicks; + // The test must be in the history namespace for the gtest forward declarations // to work. It also eliminates a bunch of ugly "history::". namespace history { diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 92bea22..53afbd5 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -47,6 +47,7 @@ #include "chromium_strings.h" #include "generated_resources.h" +using base::Time; using history::HistoryBackend; // Sends messages from the backend to us on the main thread. This must be a diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 2aee029..dcd5518 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -163,7 +163,7 @@ class HistoryService : public CancelableRequestProvider, // For adding pages to history with a specific time. This is for testing // purposes. Call the previous one to use the current time. void AddPage(const GURL& url, - Time time, + base::Time time, const void* id_scope, int32 page_id, const GURL& referrer, @@ -280,7 +280,7 @@ class HistoryService : public CancelableRequestProvider, typedef Callback4<Handle, bool, // Were we able to determine the # of visits? int, // Number of visits. - Time>::Type // Time of first visit. Only first bool is + base::Time>::Type // Time of first visit. Only first bool is // true and int is > 0. GetVisitCountToHostCallback; @@ -387,7 +387,7 @@ class HistoryService : public CancelableRequestProvider, // if they are no longer referenced. |callback| runs when the expiration is // complete. You may use null Time values to do an unbounded delete in // either direction. - void ExpireHistoryBetween(Time begin_time, Time end_time, + void ExpireHistoryBetween(base::Time begin_time, base::Time end_time, CancelableRequestConsumerBase* consumer, ExpireHistoryCallback* callback); @@ -434,7 +434,7 @@ class HistoryService : public CancelableRequestProvider, // progress or in the process of being cancelled. This is a 'fire and forget' // operation. You can pass is_null times to get unbounded time in either or // both directions. - void RemoveDownloadsBetween(Time remove_begin, Time remove_end); + void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); // Implemented by the caller of 'SearchDownloads' below, and is called when // the history system has retrieved the search results. @@ -464,7 +464,7 @@ class HistoryService : public CancelableRequestProvider, // to the segment ID. The URL and all the other information is set to the page // representing the segment. Handle QuerySegmentUsageSince(CancelableRequestConsumerBase* consumer, - const Time from_time, + const base::Time from_time, SegmentQueryCallback* callback); // Set the presentation index for the segment identified by |segment_id|. @@ -533,7 +533,7 @@ class HistoryService : public CancelableRequestProvider, const std::wstring& title, int visit_count, int typed_count, - Time last_visit, + base::Time last_visit, bool hidden); // The same as AddPageWithDetails() but takes a vector. diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index f8e6449..afaee0a 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -23,6 +23,10 @@ #include "googleurl/src/gurl.h" #include "net/base/registry_controlled_domain.h" +using base::Time; +using base::TimeDelta; +using base::TimeTicks; + /* The HistoryBackend consists of a number of components: HistoryDatabase (stores past 3 months of history) diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index e646570..b03a781 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -197,16 +197,16 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, void CreateDownload(scoped_refptr<DownloadCreateRequest> request, const DownloadCreateInfo& info); void RemoveDownload(int64 db_handle); - void RemoveDownloadsBetween(const Time remove_begin, - const Time remove_end); - void RemoveDownloads(const Time remove_end); + void RemoveDownloadsBetween(const base::Time remove_begin, + const base::Time remove_end); + void RemoveDownloads(const base::Time remove_end); void SearchDownloads(scoped_refptr<DownloadSearchRequest>, const std::wstring& search_text); // Segment usage ------------------------------------------------------------- void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request, - const Time from_time); + const base::Time from_time); void DeleteOldSegmentData(); void SetSegmentPresentationIndex(SegmentID segment_id, int index); @@ -234,8 +234,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // Calls ExpireHistoryBackend::ExpireHistoryBetween and commits the change. void ExpireHistoryBetween(scoped_refptr<ExpireHistoryRequest> request, - Time begin_time, - Time end_time); + base::Time begin_time, + base::Time end_time); // Bookmarks ----------------------------------------------------------------- @@ -282,7 +282,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // This does not schedule database commits, it is intended to be used as a // subroutine for AddPage only. It also assumes the database is valid. std::pair<URLID, VisitID> AddPageVisit(const GURL& url, - Time time, + base::Time time, VisitID referring_visit, PageTransition::Type transition); @@ -345,7 +345,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, VisitID from_visit, VisitID visit_id, PageTransition::Type transition_type, - const Time ts); + const base::Time ts); // Favicons ------------------------------------------------------------------ @@ -454,13 +454,13 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // of the timer), so we can try to ensure they're unique when they're added // to the database by using the last_recorded_time_ (q.v.). We still can't // enforce or guarantee uniqueness, since the user might set his clock back. - Time last_requested_time_; + base::Time last_requested_time_; // Timestamp of the last page addition, as it was recorded in the database. // If two or more requests come in at the same time, we increment that time // by 1 us between them so it's more likely to be unique in the database. // This keeps track of that higher-resolution timestamp. - Time last_recorded_time_; + base::Time last_recorded_time_; // When non-NULL, this is the task that should be invoked on MessageLoop* backend_destroy_message_loop_; diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 3bbb716..a762df4 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -14,6 +14,8 @@ #include "chrome/tools/profiles/thumbnail-inl.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + // This file only tests functionality where it is most convenient to call the // backend directly. Most of the history backend functions are tested by the // history unit test. Because of the elaborate callbacks involved, this is no @@ -385,4 +387,3 @@ TEST_F(HistoryBackendTest, GetPageThumbnailAfterRedirects) { } } // namespace history - diff --git a/chrome/browser/history/history_marshaling.h b/chrome/browser/history/history_marshaling.h index fa02095..6ec7d3a 100644 --- a/chrome/browser/history/history_marshaling.h +++ b/chrome/browser/history/history_marshaling.h @@ -21,7 +21,7 @@ namespace history { class HistoryAddPageArgs : public base::RefCounted<HistoryAddPageArgs> { public: HistoryAddPageArgs(const GURL& arg_url, - Time arg_time, + base::Time arg_time, const void* arg_id_scope, int32 arg_page_id, const GURL& arg_referrer, @@ -37,7 +37,7 @@ class HistoryAddPageArgs : public base::RefCounted<HistoryAddPageArgs> { } GURL url; - Time time; + base::Time time; const void* id_scope; int32 page_id; diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc index 625bc5b..cb6bfc5 100644 --- a/chrome/browser/history/history_querying_unittest.cc +++ b/chrome/browser/history/history_querying_unittest.cc @@ -8,6 +8,9 @@ #include "chrome/browser/history/history.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + // Tests the history service for querying functionality. namespace history { diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index 44abb65..5d9a2f7 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -6,6 +6,8 @@ #include "chrome/browser/history/history_types.h" +using base::Time; + namespace history { // URLRow ---------------------------------------------------------------------- diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index 5ad53205..cc64a45 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -97,10 +97,10 @@ class URLRow { typed_count_ = typed_count; } - Time last_visit() const { + base::Time last_visit() const { return last_visit_; } - void set_last_visit(Time last_visit) { + void set_last_visit(base::Time last_visit) { last_visit_ = last_visit; } @@ -151,7 +151,7 @@ class URLRow { // The date of the last visit of this URL, which saves us from having to // loop up in the visit table for things like autocomplete and expiration. - Time last_visit_; + base::Time last_visit_; // Indicates this entry should now be shown in typical UI or queries, this // is usually for subframes. @@ -173,7 +173,7 @@ class VisitRow { public: VisitRow(); VisitRow(URLID arg_url_id, - Time arg_visit_time, + base::Time arg_visit_time, VisitID arg_referring_visit, PageTransition::Type arg_transition, SegmentID arg_segment_id); @@ -184,7 +184,7 @@ class VisitRow { // Row ID into the URL table of the URL that this page is. URLID url_id; - Time visit_time; + base::Time visit_time; // Indicates another visit that was the referring page for this one. // 0 indicates no referrer. @@ -236,7 +236,7 @@ struct ImportedFavIconUsage { // associated with a VisitRow. struct PageVisit { URLID page_id; - Time visit_time; + base::Time visit_time; }; // StarredEntry --------------------------------------------------------------- @@ -278,7 +278,7 @@ struct StarredEntry { std::wstring title; // When this was added. - Time date_added; + base::Time date_added; // Group ID of the star group this entry is in. If 0, this entry is not // in a star group. @@ -305,7 +305,7 @@ struct StarredEntry { // Time the entry was last modified. This is only used for groups and // indicates the last time a URL was added as a child to the group. - Time date_group_modified; + base::Time date_group_modified; }; // URLResult ------------------------------------------------------------------- @@ -313,7 +313,7 @@ struct StarredEntry { class URLResult : public URLRow { public: URLResult() {} - URLResult(const GURL& url, Time visit_time) + URLResult(const GURL& url, base::Time visit_time) : URLRow(url), visit_time_(visit_time) { } @@ -324,8 +324,8 @@ class URLResult : public URLRow { title_match_positions_ = title_matches; } - Time visit_time() const { return visit_time_; } - void set_visit_time(Time visit_time) { visit_time_ = visit_time; } + base::Time visit_time() const { return visit_time_; } + void set_visit_time(base::Time visit_time) { visit_time_ = visit_time; } const Snippet& snippet() const { return snippet_; } @@ -342,7 +342,7 @@ class URLResult : public URLRow { friend class HistoryBackend; // The time that this result corresponds to. - Time visit_time_; + base::Time visit_time_; // These values are typically set by HistoryBackend. Snippet snippet_; @@ -373,8 +373,8 @@ class QueryResults { // // TODO(brettw): bug 1203054: This field is not currently set properly! Do // not use until the bug is fixed. - Time first_time_searched() const { return first_time_searched_; } - void set_first_time_searched(Time t) { first_time_searched_ = t; } + base::Time first_time_searched() const { return first_time_searched_; } + void set_first_time_searched(base::Time t) { first_time_searched_ = t; } // Note: If you need end_time_searched, it can be added. size_t size() const { return results_.size(); } @@ -429,7 +429,7 @@ class QueryResults { // (this is inclusive). This is used when inserting or deleting. void AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta); - Time first_time_searched_; + base::Time first_time_searched_; // The ordered list of results. The pointers inside this are owned by this // QueryResults object. @@ -460,13 +460,13 @@ struct QueryOptions { // will be searched. However, if you set one, you must set the other. // // The beginning is inclusive and the ending is exclusive. - Time begin_time; - Time end_time; + base::Time begin_time; + base::Time end_time; // Sets the query time to the last |days_ago| days to the present time. void SetRecentDayRange(int days_ago) { - end_time = Time::Now(); - begin_time = end_time - TimeDelta::FromDays(days_ago); + end_time = base::Time::Now(); + begin_time = end_time - base::TimeDelta::FromDays(days_ago); } // When set, only one visit for each URL will be returned, which will be the @@ -489,7 +489,7 @@ struct QueryOptions { // gives the time and search term of the keyword visit. struct KeywordSearchTermVisit { // The time of the visit. - Time time; + base::Time time; // The search term that was used. std::wstring term; diff --git a/chrome/browser/history/history_types_unittest.cc b/chrome/browser/history/history_types_unittest.cc index 7365e53..2bc0382 100644 --- a/chrome/browser/history/history_types_unittest.cc +++ b/chrome/browser/history/history_types_unittest.cc @@ -5,6 +5,8 @@ #include "chrome/browser/history/history_types.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + namespace history { namespace { diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index 6e00e1b..11b58b0 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -43,6 +43,9 @@ #include "chrome/tools/profiles/thumbnail-inl.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + class HistoryTest; // Specialize RunnableMethodTraits for HistoryTest so we can create callbacks. diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc index 67baced..9514b04 100644 --- a/chrome/browser/history/starred_url_database.cc +++ b/chrome/browser/history/starred_url_database.cc @@ -17,6 +17,8 @@ #include "chrome/common/sqlite_utils.h" #include "chrome/common/stl_util-inl.h" +using base::Time; + // The following table is used to store star (aka bookmark) information. This // class derives from URLDatabase, which has its own schema. // @@ -626,4 +628,3 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const std::wstring& path) { } } // namespace history - diff --git a/chrome/browser/history/starred_url_database.h b/chrome/browser/history/starred_url_database.h index 87bcef4..2d09adcd 100644 --- a/chrome/browser/history/starred_url_database.h +++ b/chrome/browser/history/starred_url_database.h @@ -73,7 +73,7 @@ class StarredURLDatabase : public URLDatabase { const std::wstring& title, UIStarID parent_group_id, int visual_order, - Time date_modified); + base::Time date_modified); // Adjusts the visual order of all children of parent_group_id with a // visual_order >= start_visual_order by delta. For example, @@ -91,7 +91,7 @@ class StarredURLDatabase : public URLDatabase { UIStarID group_id, UIStarID parent_group_id, const std::wstring& title, - const Time& date_added, + const base::Time& date_added, int visual_order, StarredEntry::Type type); diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index 46fd8c0..ef1d706 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -32,6 +32,8 @@ // an FTS table that is indexed like a normal table, and the index over it is // free since sqlite always indexes the internal rowid. +using base::Time; + namespace history { namespace { diff --git a/chrome/browser/history/text_database.h b/chrome/browser/history/text_database.h index bba9a8f..5c76086 100644 --- a/chrome/browser/history/text_database.h +++ b/chrome/browser/history/text_database.h @@ -36,7 +36,7 @@ class TextDatabase { std::wstring title; // Time the page that was returned was visited. - Time time; + base::Time time; // Identifies any found matches in the title of the document. These are not // included in the snippet. @@ -98,13 +98,13 @@ class TextDatabase { // Adds the given data to the page. Returns true on success. The data should // already be converted to UTF-8. - bool AddPageData(Time time, + bool AddPageData(base::Time time, const std::string& url, const std::string& title, const std::string& contents); // Deletes the indexed data exactly matching the given URL/time pair. - void DeletePageData(Time time, const std::string& url); + void DeletePageData(base::Time time, const std::string& url); // Optimizes the tree inside the database. This will, in addition to making // access faster, remove any deleted data from the database (normally it is @@ -133,7 +133,7 @@ class TextDatabase { const QueryOptions& options, std::vector<Match>* results, URLSet* unique_urls, - Time* first_time_searched); + base::Time* first_time_searched); // Converts the given database identifier to a filename. This does not include // the path, just the file and extension. diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index e96aa5b..21a7436 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -12,6 +12,10 @@ #include "base/string_util.h" #include "chrome/common/mru_cache.h" +using base::Time; +using base::TimeDelta; +using base::TimeTicks; + namespace history { namespace { diff --git a/chrome/browser/history/text_database_manager.h b/chrome/browser/history/text_database_manager.h index 3788ee3..fc5bdae 100644 --- a/chrome/browser/history/text_database_manager.h +++ b/chrome/browser/history/text_database_manager.h @@ -95,7 +95,7 @@ class TextDatabaseManager { // get updated to refer to the full text indexed information. The visit time // should be the time corresponding to that visit in the database. void AddPageURL(const GURL& url, URLID url_id, VisitID visit_id, - Time visit_time); + base::Time visit_time); void AddPageTitle(const GURL& url, const std::wstring& title); void AddPageContents(const GURL& url, const std::wstring& body); @@ -106,14 +106,14 @@ class TextDatabaseManager { bool AddPageData(const GURL& url, URLID url_id, VisitID visit_id, - Time visit_time, + base::Time visit_time, const std::wstring& title, const std::wstring& body); // Deletes the instance of indexed data identified by the given time and URL. // Any changes will be tracked in the optional change set for use when calling // OptimizeChangedDatabases later. change_set can be NULL. - void DeletePageData(Time time, const GURL& url, + void DeletePageData(base::Time time, const GURL& url, ChangeSet* change_set); // The text database manager keeps a list of changes that are made to the @@ -124,7 +124,7 @@ class TextDatabaseManager { // // Either or both times my be is_null to be unbounded in that direction. When // non-null, the range is [begin, end). - void DeleteFromUncommitted(Time begin, Time end); + void DeleteFromUncommitted(base::Time begin, base::Time end); // Same as DeleteFromUncommitted but for a single URL. void DeleteURLFromUncommitted(const GURL& url); @@ -149,7 +149,7 @@ class TextDatabaseManager { void GetTextMatches(const std::wstring& query, const QueryOptions& options, std::vector<TextDatabase::Match>* results, - Time* first_time_searched); + base::Time* first_time_searched); private: // These tests call ExpireRecentChangesForTime to force expiration. @@ -161,12 +161,12 @@ class TextDatabaseManager { // visit, title, and body all come in at different times. class PageInfo { public: - PageInfo(URLID url_id, VisitID visit_id, Time visit_time); + PageInfo(URLID url_id, VisitID visit_id, base::Time visit_time); // Getters. URLID url_id() const { return url_id_; } VisitID visit_id() const { return visit_id_; } - Time visit_time() const { return visit_time_; } + base::Time visit_time() const { return visit_time_; } const std::wstring& title() const { return title_; } const std::wstring& body() const { return body_; } @@ -183,7 +183,7 @@ class TextDatabaseManager { // Returns true if this entry was added too long ago and we should give up // waiting for more data. The current time is passed in as an argument so we // can check many without re-querying the timer. - bool Expired(TimeTicks now) const; + bool Expired(base::TimeTicks now) const; private: URLID url_id_; @@ -191,11 +191,11 @@ class TextDatabaseManager { // Time of the visit of the URL. This will be the value stored in the URL // and visit tables for the entry. - Time visit_time_; + base::Time visit_time_; // When this page entry was created. We have a cap on the maximum time that // an entry will be in the queue before being flushed to the database. - TimeTicks added_time_; + base::TimeTicks added_time_; // Will be the string " " when they are set to distinguish set and unset. std::wstring title_; @@ -203,8 +203,8 @@ class TextDatabaseManager { }; // Converts the given time to a database identifier or vice-versa. - static TextDatabase::DBIdent TimeToID(Time time); - static Time IDToTime(TextDatabase::DBIdent id); + static TextDatabase::DBIdent TimeToID(base::Time time); + static base::Time IDToTime(TextDatabase::DBIdent id); // Returns a text database for the given identifier or time. This file will // be created if it doesn't exist and |for_writing| is set. On error, @@ -217,7 +217,7 @@ class TextDatabaseManager { // The pointer will be tracked in the cache. The caller should not store it // or delete it since it will get automatically deleted as necessary. TextDatabase* GetDB(TextDatabase::DBIdent id, bool for_writing); - TextDatabase* GetDBForTime(Time time, bool for_writing); + TextDatabase* GetDBForTime(base::Time time, bool for_writing); // Populates the present_databases_ list based on which files are on disk. // When the list is already initialized, this will do nothing, so you can @@ -234,7 +234,7 @@ class TextDatabaseManager { // Given "now," this will expire old things from the recent_changes_ list. // This is used as the backend for FlushOldChanges and is called directly // by the unit tests with fake times. - void FlushOldChangesForTime(TimeTicks now); + void FlushOldChangesForTime(base::TimeTicks now); // Directory holding our index files. const std::wstring dir_; diff --git a/chrome/browser/history/text_database_manager_unittest.cc b/chrome/browser/history/text_database_manager_unittest.cc index 8b7c6b9..fd9a46d 100644 --- a/chrome/browser/history/text_database_manager_unittest.cc +++ b/chrome/browser/history/text_database_manager_unittest.cc @@ -7,6 +7,10 @@ #include "chrome/browser/history/text_database_manager.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; +using base::TimeTicks; + namespace history { namespace { diff --git a/chrome/browser/history/text_database_unittest.cc b/chrome/browser/history/text_database_unittest.cc index 511f114..550a347 100644 --- a/chrome/browser/history/text_database_unittest.cc +++ b/chrome/browser/history/text_database_unittest.cc @@ -10,6 +10,8 @@ #include "chrome/browser/history/text_database.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + namespace history { namespace { diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index 05126b8..7cef980 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -13,6 +13,8 @@ #include "chrome/common/thumbnail_score.h" #include "skia/include/SkBitmap.h" +using base::Time; + namespace history { // Version number of the database. diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h index f98d8e9..a72c0ef 100644 --- a/chrome/browser/history/thumbnail_database.h +++ b/chrome/browser/history/thumbnail_database.h @@ -15,7 +15,7 @@ struct sqlite3; struct ThumbnailScore; -class Time; +class base::Time; namespace history { @@ -80,10 +80,10 @@ class ThumbnailDatabase { // should be refreshed. bool SetFavIcon(FavIconID icon_id, const std::vector<unsigned char>& icon_data, - Time time); + base::Time time); // Sets the time the favicon was last updated. - bool SetFavIconLastUpdateTime(FavIconID icon_id, const Time& time); + bool SetFavIconLastUpdateTime(FavIconID icon_id, const base::Time& time); // Returns the id of the entry in the favicon database with the specified url. // Returns 0 if no entry exists for the specified url. @@ -92,7 +92,7 @@ class ThumbnailDatabase { // Gets the png encoded favicon and last updated time for the specified // favicon id. bool GetFavIcon(FavIconID icon_id, - Time* last_updated, + base::Time* last_updated, std::vector<unsigned char>* png_icon_data, GURL* icon_url); diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index 34b5042..318d385 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -15,6 +15,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "SkBitmap.h" +using base::Time; +using base::TimeDelta; + namespace history { namespace { diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc index aeb9ed2..83b038b 100644 --- a/chrome/browser/history/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -12,6 +12,8 @@ #include "chrome/common/sqlite_utils.h" #include "googleurl/src/gurl.h" +using base::Time; + namespace history { const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc index b365d03..c58029d 100644 --- a/chrome/browser/history/url_database_unittest.cc +++ b/chrome/browser/history/url_database_unittest.cc @@ -10,6 +10,9 @@ #include "chrome/common/sqlite_utils.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + namespace history { namespace { diff --git a/chrome/browser/history/visit_database.cc b/chrome/browser/history/visit_database.cc index 6ab526b..fbba4d4 100644 --- a/chrome/browser/history/visit_database.cc +++ b/chrome/browser/history/visit_database.cc @@ -12,6 +12,8 @@ #include "chrome/browser/history/url_database.h" #include "chrome/common/page_transition_types.h" +using base::Time; + // Rows, in order, of the visit table. #define HISTORY_VISIT_ROW_FIELDS \ " id,url,visit_time,from_visit,transition,segment_id,is_indexed " @@ -365,4 +367,3 @@ bool VisitDatabase::GetVisitCountToHost(const GURL& url, } } // namespace history - diff --git a/chrome/browser/history/visit_database.h b/chrome/browser/history/visit_database.h index 0e82233..137fdc0 100644 --- a/chrome/browser/history/visit_database.h +++ b/chrome/browser/history/visit_database.h @@ -61,8 +61,8 @@ class VisitDatabase { // is used for history expiration.) // // The results will be in increasing order of date. - void GetAllVisitsInRange(Time begin_time, Time end_time, int max_results, - VisitVector* visits); + void GetAllVisitsInRange(base::Time begin_time, base::Time end_time, + int max_results, VisitVector* visits); // Fills all visits in the given time range into the given vector that should // be user-visible, which excludes things like redirects and subframes. The @@ -75,7 +75,7 @@ class VisitDatabase { // // When |most_recent_visit_only| is set, only one visit for each URL will be // returned, and it will be the most recent one in the time range. - void GetVisibleVisitsInRange(Time begin_time, Time end_time, + void GetVisibleVisitsInRange(base::Time begin_time, base::Time end_time, bool most_recent_visit_only, int max_count, VisitVector* visits); @@ -116,7 +116,8 @@ class VisitDatabase { // schemes are ignored and false is returned). // count is set to the number of visits, first_visit is set to the first time // the host was visited. Returns true on success. - bool GetVisitCountToHost(const GURL& url, int* count, Time* first_visit); + bool GetVisitCountToHost(const GURL& url, int* count, + base::Time* first_visit); protected: // Returns the database and statement cache for the functions in this @@ -144,4 +145,3 @@ class VisitDatabase { } // history #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ - diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc index 857c006..1992f0b 100644 --- a/chrome/browser/history/visit_database_unittest.cc +++ b/chrome/browser/history/visit_database_unittest.cc @@ -11,6 +11,9 @@ #include "chrome/common/sqlite_utils.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + namespace history { namespace { diff --git a/chrome/browser/history/visitsegment_database.cc b/chrome/browser/history/visitsegment_database.cc index 8754018..0da96a1 100644 --- a/chrome/browser/history/visitsegment_database.cc +++ b/chrome/browser/history/visitsegment_database.cc @@ -10,6 +10,8 @@ #include "chrome/common/sqlite_compiled_statement.h" #include "chrome/common/sqlite_utils.h" +using base::Time; + // The following tables are used to store url segment information. // // segments @@ -386,4 +388,3 @@ bool VisitSegmentDatabase::DeleteSegmentForURL(URLID url_id) { } } // namespace history - diff --git a/chrome/browser/history/visitsegment_database.h b/chrome/browser/history/visitsegment_database.h index 8165f88..6a4081c 100644 --- a/chrome/browser/history/visitsegment_database.h +++ b/chrome/browser/history/visitsegment_database.h @@ -45,17 +45,17 @@ class VisitSegmentDatabase { // Increase the segment visit count by the provided amount. Return true on // success. - bool IncreaseSegmentVisitCount(SegmentID segment_id, const Time& ts, + bool IncreaseSegmentVisitCount(SegmentID segment_id, const base::Time& ts, int amount); // Compute the segment usage since |from_time| using the provided aggregator. // A PageUsageData is added in |result| for the nine highest-scored segments. - void QuerySegmentUsage(const Time& from_time, + void QuerySegmentUsage(const base::Time& from_time, std::vector<PageUsageData*>* result); // Delete all the segment usage data which is older than the provided time // stamp. - void DeleteSegmentData(const Time& older_than); + void DeleteSegmentData(const base::Time& older_than); // Change the presentation id for the segment identified by |segment_id| void SetSegmentPresentationIndex(SegmentID segment_id, int index); |