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

Unified Diff: components/history/core/browser/history_types.h

Issue 2781263002: Some C++11 cleanup of history types. (Closed)
Patch Set: Fix Android Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/history/core/browser/history_types.h
diff --git a/components/history/core/browser/history_types.h b/components/history/core/browser/history_types.h
index e560ed7c020ef6ba98317ac7d7a3bbe50b42202a..9189b068c5a15a32913cde65ed493b4261b6a0ce 100644
--- a/components/history/core/browser/history_types.h
+++ b/components/history/core/browser/history_types.h
@@ -78,23 +78,23 @@ class VisitRow {
~VisitRow();
// ID of this row (visit ID, used a a referrer for other visits).
- VisitID visit_id;
+ VisitID visit_id = 0;
// Row ID into the URL table of the URL that this page is.
- URLID url_id;
+ URLID url_id = 0;
base::Time visit_time;
// Indicates another visit that was the referring page for this one.
// 0 indicates no referrer.
- VisitID referring_visit;
+ VisitID referring_visit = 0;
// A combination of bits from PageTransition.
- ui::PageTransition transition;
+ ui::PageTransition transition = ui::PAGE_TRANSITION_LINK;
// The segment id (see visitsegment_database.*).
// If 0, the segment id is null in the table.
- SegmentID segment_id;
+ SegmentID segment_id = 0;
// Record how much time a user has this visit starting from the user
// opened this visit to the user closed or ended this visit.
@@ -103,7 +103,7 @@ class VisitRow {
base::TimeDelta visit_duration;
// Compares two visits based on dates, for sorting.
- bool operator<(const VisitRow& other) {
+ bool operator<(const VisitRow& other) const {
return visit_time < other.visit_time;
}
@@ -123,7 +123,7 @@ typedef std::pair<base::Time, ui::PageTransition> VisitInfo;
// views are only interested in the time, and not the other information
// associated with a VisitRow.
struct PageVisit {
- URLID page_id;
+ URLID page_id = 0;
base::Time visit_time;
};
@@ -205,7 +205,7 @@ class QueryResults {
// time an entry with that URL appears. Normally, each URL will have one or
// very few indices after it, so we optimize this to use statically allocated
// memory when possible.
- typedef std::map<GURL, base::StackVector<size_t, 4> > URLToResultIndices;
+ typedef std::map<GURL, base::StackVector<size_t, 4>> URLToResultIndices;
// Inserts an entry into the |url_to_results_| map saying that the given URL
// is at the given index in the results_.
@@ -251,8 +251,8 @@ struct QueryOptions {
// The maximum number of results to return. The results will be sorted with
// the most recent first, so older results may not be returned if there is not
- // enough room. When 0, this will return everything (the default).
- int max_count;
+ // enough room. When 0, this will return everything.
+ int max_count = 0;
enum DuplicateHandling {
// Omit visits for which there is a more recent visit to the same URL.
@@ -269,11 +269,12 @@ struct QueryOptions {
};
// Allows the caller to specify how duplicate URLs in the result set should
- // be handled. The default is REMOVE_DUPLICATES.
- DuplicateHandling duplicate_policy;
+ // be handled.
+ DuplicateHandling duplicate_policy = REMOVE_ALL_DUPLICATES;
// Allows the caller to specify the matching algorithm for text queries.
- query_parser::MatchingAlgorithm matching_algorithm;
+ query_parser::MatchingAlgorithm matching_algorithm =
+ query_parser::MatchingAlgorithm::DEFAULT;
// Helpers to get the effective parameters values, since a value of 0 means
// "unspecified".
@@ -291,7 +292,7 @@ struct QueryURLResult {
// Indicates whether the call to HistoryBackend::QueryURL was successfull
// or not. If false, then both |row| and |visits| fields are undefined.
- bool success;
+ bool success = false;
URLRow row;
VisitVector visits;
};
@@ -304,8 +305,8 @@ struct VisibleVisitCountToHostResult {
// Indicates whether the call to HistoryBackend::GetVisibleVisitCountToHost
// was successful or not. If false, then both |count| and |first_visit| are
// undefined.
- bool success;
- int count;
+ bool success = false;
+ int count = 0;
base::Time first_visit;
};
@@ -314,11 +315,11 @@ struct VisibleVisitCountToHostResult {
// Holds the per-URL information of the most visited query.
struct MostVisitedURL {
MostVisitedURL();
- MostVisitedURL(const GURL& url, const base::string16& title);
MostVisitedURL(const GURL& url,
const base::string16& title,
- const base::Time& last_forced_time);
+ base::Time last_forced_time = base::Time());
MostVisitedURL(const MostVisitedURL& other);
+ MostVisitedURL(MostVisitedURL&& other) noexcept;
~MostVisitedURL();
GURL url;
@@ -331,6 +332,8 @@ struct MostVisitedURL {
RedirectList redirects;
+ MostVisitedURL& operator=(const MostVisitedURL&);
+
bool operator==(const MostVisitedURL& other) const {
return url == other.url;
}
@@ -343,22 +346,23 @@ struct FilteredURL {
struct ExtendedInfo {
ExtendedInfo();
// The absolute number of visits.
- unsigned int total_visits;
+ unsigned int total_visits = 0;
// The number of visits, as seen by the Most Visited NTP pane.
- unsigned int visits;
+ unsigned int visits = 0;
// The total number of seconds that the page was open.
- int64_t duration_opened;
+ int64_t duration_opened = 0;
// The time when the page was last visited.
base::Time last_visit_time;
};
FilteredURL();
explicit FilteredURL(const PageUsageData& data);
+ FilteredURL(FilteredURL&& other) noexcept;
~FilteredURL();
GURL url;
base::string16 title;
- double score;
+ double score = 0.0;
ExtendedInfo extended_info;
};
@@ -437,7 +441,7 @@ struct TopSitesDelta {
MostVisitedURLWithRankList moved;
};
-typedef std::map<GURL, scoped_refptr<base::RefCountedBytes> > URLToThumbnailMap;
+typedef std::map<GURL, scoped_refptr<base::RefCountedBytes>> URLToThumbnailMap;
// Used when migrating most visited thumbnails out of history and into topsites.
struct ThumbnailMigration {
@@ -479,8 +483,8 @@ typedef std::map<GURL, std::pair<int, base::Time>> OriginCountAndLastVisitMap;
struct HistoryCountResult {
// Indicates whether the call to HistoryBackend::GetHistoryCount was
// successful or not. If false, then |count| is undefined.
- bool success;
- int count;
+ bool success = false;
+ int count = 0;
};
// Favicons -------------------------------------------------------------------
@@ -488,22 +492,26 @@ struct HistoryCountResult {
// Used for the mapping between the page and icon.
struct IconMapping {
IconMapping();
+ IconMapping(const IconMapping&);
+ IconMapping(IconMapping&&) noexcept;
~IconMapping();
+ IconMapping& operator=(const IconMapping&);
+
// The unique id of the mapping.
- IconMappingID mapping_id;
+ IconMappingID mapping_id = 0;
// The url of a web page.
GURL page_url;
// The unique id of the icon.
- favicon_base::FaviconID icon_id;
+ favicon_base::FaviconID icon_id = 0;
// The url of the icon.
GURL icon_url;
// The type of icon.
- favicon_base::IconType icon_type;
+ favicon_base::IconType icon_type = favicon_base::INVALID_ICON;
};
// Defines a favicon bitmap and its associated pixel size.
@@ -512,7 +520,7 @@ struct FaviconBitmapIDSize {
~FaviconBitmapIDSize();
// The unique id of the favicon bitmap.
- FaviconBitmapID bitmap_id;
+ FaviconBitmapID bitmap_id = 0;
// The pixel dimensions of the associated bitmap.
gfx::Size pixel_size;
@@ -525,10 +533,10 @@ struct FaviconBitmap {
~FaviconBitmap();
// The unique id of the bitmap.
- FaviconBitmapID bitmap_id;
+ FaviconBitmapID bitmap_id = 0;
// The id of the favicon to which the bitmap belongs to.
- favicon_base::FaviconID icon_id;
+ favicon_base::FaviconID icon_id = 0;
// Time at which |bitmap_data| was last updated.
base::Time last_updated;
« no previous file with comments | « components/history/core/browser/history_backend.cc ('k') | components/history/core/browser/history_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698