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

Unified Diff: components/history/core/browser/url_row.cc

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
« no previous file with comments | « components/history/core/browser/url_row.h ('k') | components/query_parser/snippet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/url_row.cc
diff --git a/components/history/core/browser/url_row.cc b/components/history/core/browser/url_row.cc
index 096672d5180f78d4a75e91607db9b47e846336f1..130442d6eeb27dc39a40a779dc360c07fd0f9c2f 100644
--- a/components/history/core/browser/url_row.cc
+++ b/components/history/core/browser/url_row.cc
@@ -9,38 +9,30 @@
namespace history {
URLRow::URLRow() {
- Initialize();
}
URLRow::URLRow(const GURL& url) : url_(url) {
- // Initialize will not set the URL, so our initialization above will stay.
- Initialize();
}
-URLRow::URLRow(const GURL& url, URLID id) : url_(url) {
- // Initialize will not set the URL, so our initialization above will stay.
- Initialize();
- // Initialize will zero the id_, so set it here.
- id_ = id;
-}
+URLRow::URLRow(const GURL& url, URLID id) : id_(id), url_(url) {}
URLRow::URLRow(const URLRow& other) = default;
+// TODO(bug 706963) this should be implemented as "= default" when Android
+// toolchain is updated.
+URLRow::URLRow(URLRow&& other) noexcept
+ : id_(other.id_),
+ url_(std::move(other.url_)),
+ title_(std::move(other.title_)),
+ visit_count_(other.visit_count_),
+ typed_count_(other.typed_count_),
+ last_visit_(other.last_visit_),
+ hidden_(other.hidden_) {}
+
URLRow::~URLRow() {
}
-URLRow& URLRow::operator=(const URLRow& other) {
- if (this == &other)
- return *this;
- id_ = other.id_;
- url_ = other.url_;
- title_ = other.title_;
- visit_count_ = other.visit_count_;
- typed_count_ = other.typed_count_;
- last_visit_ = other.last_visit_;
- hidden_ = other.hidden_;
- return *this;
-}
+URLRow& URLRow::operator=(const URLRow& other) = default;
void URLRow::Swap(URLRow* other) {
std::swap(id_, other->id_);
@@ -52,40 +44,29 @@ void URLRow::Swap(URLRow* other) {
std::swap(hidden_, other->hidden_);
}
-void URLRow::Initialize() {
- id_ = 0;
- visit_count_ = 0;
- typed_count_ = 0;
- last_visit_ = base::Time();
- hidden_ = false;
-}
-
-
-URLResult::URLResult()
- : blocked_visit_(false) {
-}
+URLResult::URLResult() {}
URLResult::URLResult(const GURL& url, base::Time visit_time)
- : URLRow(url),
- visit_time_(visit_time),
- blocked_visit_(false) {
-}
+ : URLRow(url), visit_time_(visit_time) {}
-URLResult::URLResult(const GURL& url,
- const query_parser::Snippet::MatchPositions& title_matches)
- : URLRow(url) {
- title_match_positions_ = title_matches;
-}
-URLResult::URLResult(const URLRow& url_row)
- : URLRow(url_row),
- blocked_visit_(false) {
-}
+URLResult::URLResult(const URLRow& url_row) : URLRow(url_row) {}
URLResult::URLResult(const URLResult& other) = default;
+// TODO(bug 706963) this should be implemented as "= default" when Android
+// toolchain is updated.
+URLResult::URLResult(URLResult&& other) noexcept
+ : URLRow(std::move(other)),
+ visit_time_(other.visit_time_),
+ snippet_(std::move(other.snippet_)),
+ title_match_positions_(std::move(other.title_match_positions_)),
+ blocked_visit_(other.blocked_visit_) {}
+
URLResult::~URLResult() {
}
+URLResult& URLResult::operator=(const URLResult&) = default;
+
void URLResult::SwapResult(URLResult* other) {
URLRow::Swap(other);
std::swap(visit_time_, other->visit_time_);
« no previous file with comments | « components/history/core/browser/url_row.h ('k') | components/query_parser/snippet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698