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

Unified Diff: net/dns/record_parsed.h

Issue 14697022: Cache for mDNS records (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@record_parsed_klassbit
Patch Set: 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_parsed.h
diff --git a/net/dns/record_parsed.h b/net/dns/record_parsed.h
index da58b2661303f5f4f0fc8e549b2b8cff0388fdc4..9520ff9ac6c0a70ae4d120a597243f27ea743b04 100644
--- a/net/dns/record_parsed.h
+++ b/net/dns/record_parsed.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/time.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
@@ -19,25 +20,35 @@ class RecordRdata;
// has been parsed into a data structure.
class NET_EXPORT_PRIVATE RecordParsed {
public:
+ RecordParsed(const RecordParsed&);
virtual ~RecordParsed();
// All records are inherently immutable. Return a const pointer.
- static scoped_ptr<const RecordParsed> CreateFrom(DnsRecordParser* parser);
+ static scoped_ptr<const RecordParsed> CreateFrom(DnsRecordParser* parser,
+ base::Time time_created);
const std::string& name() const { return name_; }
uint16 type() const { return type_; }
uint16 klass() const { return klass_; }
uint32 ttl() const { return ttl_; }
+ base::Time time_created() const { return time_created_; }
+
template <class T> const T* rdata() const {
if (T::kType != type_)
return NULL;
return static_cast<const T*>(rdata_.get());
}
+ // Check if two records have the same data. Ignores time_created and ttl.
+ // If |is_mdns| is true, ignore the top bit of the class
+ // (the cache flush bit).
+ bool IsEqual(const RecordParsed* other, bool is_mdns) const;
+
private:
- RecordParsed(const std::string& name, uint16 type, uint16 klass, uint32 ttl,
- scoped_ptr<const RecordRdata> rdata);
+ RecordParsed(const std::string& name, uint16 type, uint16 klass,
+ uint32 ttl, scoped_ptr<const RecordRdata> rdata,
+ base::Time time_created);
std::string name_; // in dotted form
const uint16 type_;
@@ -46,7 +57,7 @@ class NET_EXPORT_PRIVATE RecordParsed {
const scoped_ptr<const RecordRdata> rdata_;
- DISALLOW_COPY_AND_ASSIGN(RecordParsed);
+ const base::Time time_created_;
};
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698