OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/dns/record_parsed.h" | 5 #include "net/dns/record_parsed.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/dns/dns_response.h" | 8 #include "net/dns/dns_response.h" |
9 #include "net/dns/record_rdata.h" | 9 #include "net/dns/record_rdata.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 RecordParsed::RecordParsed(const std::string& name, uint16 type, uint16 klass, | 13 RecordParsed::RecordParsed(const std::string& name, |
14 uint32 ttl, scoped_ptr<const RecordRdata> rdata, | 14 uint16 type, |
| 15 uint16 klass, |
| 16 uint32 ttl, |
| 17 scoped_ptr<const RecordRdata> rdata, |
15 base::Time time_created) | 18 base::Time time_created) |
16 : name_(name), type_(type), klass_(klass), ttl_(ttl), rdata_(rdata.Pass()), | 19 : name_(name), |
| 20 type_(type), |
| 21 klass_(klass), |
| 22 ttl_(ttl), |
| 23 rdata_(rdata.Pass()), |
17 time_created_(time_created) { | 24 time_created_(time_created) { |
18 } | 25 } |
19 | 26 |
20 RecordParsed::~RecordParsed() { | 27 RecordParsed::~RecordParsed() { |
21 } | 28 } |
22 | 29 |
23 // static | 30 // static |
24 scoped_ptr<const RecordParsed> RecordParsed::CreateFrom( | 31 scoped_ptr<const RecordParsed> RecordParsed::CreateFrom( |
25 DnsRecordParser* parser, | 32 DnsRecordParser* parser, |
26 base::Time time_created) { | 33 base::Time time_created) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool RecordParsed::IsEqual(const RecordParsed* other, bool is_mdns) const { | 78 bool RecordParsed::IsEqual(const RecordParsed* other, bool is_mdns) const { |
72 DCHECK(other); | 79 DCHECK(other); |
73 uint16 klass = klass_; | 80 uint16 klass = klass_; |
74 uint16 other_klass = other->klass_; | 81 uint16 other_klass = other->klass_; |
75 | 82 |
76 if (is_mdns) { | 83 if (is_mdns) { |
77 klass &= dns_protocol::kMDnsClassMask; | 84 klass &= dns_protocol::kMDnsClassMask; |
78 other_klass &= dns_protocol::kMDnsClassMask; | 85 other_klass &= dns_protocol::kMDnsClassMask; |
79 } | 86 } |
80 | 87 |
81 return name_ == other->name_ && | 88 return name_ == other->name_ && klass == other_klass && |
82 klass == other_klass && | 89 type_ == other->type_ && rdata_->IsEqual(other->rdata_.get()); |
83 type_ == other->type_ && | |
84 rdata_->IsEqual(other->rdata_.get()); | |
85 } | 90 } |
86 } | 91 } |
OLD | NEW |