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

Unified Diff: net/dns/record_rdata.cc

Issue 14697022: Cache for mDNS records (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@record_parsed_klassbit
Patch Set: Removed copy constructor from RecordParsed Created 7 years, 7 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: net/dns/record_rdata.cc
diff --git a/net/dns/record_rdata.cc b/net/dns/record_rdata.cc
index 1de3a4c8b5fedaa379ce0d7f217825a889daba72..a1bc7fe6c76b2c14b7baf6d4b00edd3897bdbcde 100644
--- a/net/dns/record_rdata.cc
+++ b/net/dns/record_rdata.cc
@@ -42,6 +42,19 @@ scoped_ptr<SrvRecordRdata> SrvRecordRdata::Create(
return rdata.Pass();
}
+uint16 SrvRecordRdata::Type() const {
+ return SrvRecordRdata::kType;
+}
+
+bool SrvRecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const SrvRecordRdata* srv_other = static_cast<const SrvRecordRdata*>(other);
+ return weight_ == srv_other->weight_ &&
+ port_ == srv_other->port_ &&
+ priority_ == srv_other->priority_ &&
+ target_ == srv_other->target_;
+}
+
ARecordRdata::ARecordRdata() {
}
@@ -65,6 +78,49 @@ scoped_ptr<ARecordRdata> ARecordRdata::Create(
return rdata.Pass();
}
+uint16 ARecordRdata::Type() const {
+ return ARecordRdata::kType;
+}
+
+bool ARecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const ARecordRdata* a_other = static_cast<const ARecordRdata*>(other);
+ return address_ == a_other->address_;
+}
+
+AAAARecordRdata::AAAARecordRdata() {
+}
+
+AAAARecordRdata::~AAAARecordRdata() {
+}
+
+// static
+scoped_ptr<AAAARecordRdata> AAAARecordRdata::Create(
+ const base::StringPiece& data,
+ const DnsRecordParser& parser) {
+ if (data.size() != kIPv6AddressSize)
+ return scoped_ptr<AAAARecordRdata>();
+
+ scoped_ptr<AAAARecordRdata> rdata(new AAAARecordRdata);
+
+ rdata->address_.resize(kIPv6AddressSize);
+ for (unsigned i = 0; i < kIPv6AddressSize; ++i) {
+ rdata->address_[i] = data[i];
+ }
+
+ return rdata.Pass();
+}
+
+uint16 AAAARecordRdata::Type() const {
+ return AAAARecordRdata::kType;
+}
+
+bool AAAARecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const AAAARecordRdata* a_other = static_cast<const AAAARecordRdata*>(other);
+ return address_ == a_other->address_;
+}
+
CnameRecordRdata::CnameRecordRdata() {
}
@@ -83,6 +139,17 @@ scoped_ptr<CnameRecordRdata> CnameRecordRdata::Create(
return rdata.Pass();
}
+uint16 CnameRecordRdata::Type() const {
+ return CnameRecordRdata::kType;
+}
+
+bool CnameRecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const CnameRecordRdata* cname_other =
+ static_cast<const CnameRecordRdata*>(other);
+ return cname_ == cname_other->cname_;
+}
+
PtrRecordRdata::PtrRecordRdata() {
}
@@ -101,6 +168,16 @@ scoped_ptr<PtrRecordRdata> PtrRecordRdata::Create(
return rdata.Pass();
}
+uint16 PtrRecordRdata::Type() const {
+ return PtrRecordRdata::kType;
+}
+
+bool PtrRecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const PtrRecordRdata* ptr_other = static_cast<const PtrRecordRdata*>(other);
+ return ptrdomain_ == ptr_other->ptrdomain_;
+}
+
TxtRecordRdata::TxtRecordRdata() {
}
@@ -128,4 +205,15 @@ scoped_ptr<TxtRecordRdata> TxtRecordRdata::Create(
return rdata.Pass();
}
+uint16 TxtRecordRdata::Type() const {
+ return TxtRecordRdata::kType;
+}
+
+bool TxtRecordRdata::IsEqual(const RecordRdata* other) const {
+ if (other->Type() != Type()) return false;
+ const TxtRecordRdata* txt_other = static_cast<const TxtRecordRdata*>(other);
+
szym 2013/05/21 22:09:05 nit: remove blank
Noam Samuel 2013/05/21 23:00:56 Done.
+ return texts_ == txt_other->texts_;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698