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, uint16 type, uint16 klass, |
14 uint32 ttl, scoped_ptr<const RecordRdata> rdata, | 14 uint32 ttl, scoped_ptr<const RecordRdata> rdata, |
15 base::Time time_created) | 15 base::Time time_created) |
16 : name_(name), type_(type), klass_(klass), ttl_(ttl), rdata_(rdata.Pass()), | 16 : name_(name), type_(type), klass_(klass), ttl_(ttl), rdata_(rdata.Pass()), |
17 time_created_(time_created) { | 17 time_created_(time_created) { |
18 } | 18 } |
19 | 19 |
| 20 scoped_ptr<const RecordParsed> RecordParsed::Clone() const { |
| 21 return scoped_ptr<const RecordParsed>(new RecordParsed( |
| 22 name_, type_, klass_, ttl_, rdata_->Clone(), time_created_)); |
| 23 } |
| 24 |
20 RecordParsed::~RecordParsed() { | 25 RecordParsed::~RecordParsed() { |
21 } | 26 } |
22 | 27 |
23 // static | 28 // static |
24 scoped_ptr<const RecordParsed> RecordParsed::CreateFrom( | 29 scoped_ptr<const RecordParsed> RecordParsed::CreateFrom( |
25 DnsRecordParser* parser, | 30 DnsRecordParser* parser, |
26 base::Time time_created) { | 31 base::Time time_created) { |
27 DnsResourceRecord record; | 32 DnsResourceRecord record; |
28 scoped_ptr<const RecordRdata> rdata; | 33 scoped_ptr<const RecordRdata> rdata; |
29 | 34 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 klass &= dns_protocol::kMDnsClassMask; | 79 klass &= dns_protocol::kMDnsClassMask; |
75 other_klass &= dns_protocol::kMDnsClassMask; | 80 other_klass &= dns_protocol::kMDnsClassMask; |
76 } | 81 } |
77 | 82 |
78 return name_ == other->name_ && | 83 return name_ == other->name_ && |
79 klass == other_klass && | 84 klass == other_klass && |
80 type_ == other->type_ && | 85 type_ == other->type_ && |
81 rdata_->IsEqual(other->rdata_.get()); | 86 rdata_->IsEqual(other->rdata_.get()); |
82 } | 87 } |
83 } | 88 } |
OLD | NEW |