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

Unified Diff: net/dns/mdns_client_impl.h

Issue 132693025: Add the ability for MDnsListener to actively refresh records (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/mdns_client_impl.h
diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h
index f75598560ab43c0634f656c109630daee1b6e2b4..76607880befc42c77a6d1d7a08399eebac34efec 100644
--- a/net/dns/mdns_client_impl.h
+++ b/net/dns/mdns_client_impl.h
@@ -133,7 +133,7 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
ListenerMap;
// Alert listeners of an update to the cache.
- void AlertListeners(MDnsListener::UpdateType update_type,
+ void AlertListeners(MDnsCache::UpdateType update_type,
const ListenerKey& key, const RecordParsed* record);
// Schedule a cache cleanup to a specific time, cancelling other cleanups.
@@ -156,7 +156,7 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
MDnsClientImpl* client_;
MDnsCache cache_;
- base::CancelableCallback<void()> cleanup_callback_;
+ base::CancelableClosure cleanup_callback_;
base::Time scheduled_cleanup_;
scoped_ptr<MDnsConnection> connection_;
@@ -204,6 +204,9 @@ class MDnsListenerImpl : public MDnsListener,
// MDnsListener implementation:
virtual bool Start() OVERRIDE;
+ // Actively refresh any received records.
+ virtual void SetActiveRefresh(bool active_refresh) OVERRIDE;
+
virtual const std::string& GetName() const OVERRIDE;
virtual uint16 GetType() const OVERRIDE;
@@ -211,19 +214,27 @@ class MDnsListenerImpl : public MDnsListener,
MDnsListener::Delegate* delegate() { return delegate_; }
// Alert the delegate of a record update.
- void AlertDelegate(MDnsListener::UpdateType update_type,
- const RecordParsed* record_parsed);
+ void HandleRecordUpdate(MDnsCache::UpdateType update_type,
+ const RecordParsed* record_parsed);
// Alert the delegate of the existence of an Nsec record.
void AlertNsecRecord();
private:
+ void ScheduleNextRefresh();
+ void DoRefresh();
+
uint16 rrtype_;
std::string name_;
MDnsClientImpl* client_;
MDnsListener::Delegate* delegate_;
+ base::Time last_update_;
+ uint32 ttl_;
bool started_;
+ bool active_refresh_;
+
+ base::CancelableClosure next_refresh_;
DISALLOW_COPY_AND_ASSIGN(MDnsListenerImpl);
};

Powered by Google App Engine
This is Rietveld 408576698