summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/dns_global.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 02:11:03 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 02:11:03 +0000
commiteb255d3bd77fa891cd909d5779763a3e028759d2 (patch)
treed20650c59eb2150f73f27173e0325a05fa288836 /chrome/browser/net/dns_global.cc
parentc8220644056dfdb2d48f5d00578888a00ca02fe7 (diff)
downloadchromium_src-eb255d3bd77fa891cd909d5779763a3e028759d2.zip
chromium_src-eb255d3bd77fa891cd909d5779763a3e028759d2.tar.gz
chromium_src-eb255d3bd77fa891cd909d5779763a3e028759d2.tar.bz2
Re-land another subset of r18520.
This particular subset should be a no-op: It adds an unused interface method (OnResolutionCancelled), and an unused test (CancelObserver), and lastly renames Cancel --> MarkAsCanceled(). The code in "dns_global.cc" is also unused since it is unreachable. The original code review that this belongs to is:<http://codereview.chromium.org/125171>. (BUG=14138) The original was backed out because of a valgrind linux error (BUG=14218), so I am now re-landing in smaller chunks to identify where the problem resides. Review URL: http://codereview.chromium.org/126253 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_global.cc')
-rw-r--r--chrome/browser/net/dns_global.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index cf7145c..9e4c8f6 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -149,6 +149,9 @@ class PrefetchObserver : public net::HostResolver::Observer {
int request_id,
bool was_resolved,
const net::HostResolver::RequestInfo& request_info);
+ virtual void OnCancelResolution(
+ int request_id,
+ const net::HostResolver::RequestInfo& request_info);
static void DnsGetFirstResolutionsHtml(std::string* output);
static void SaveStartupListAsPref(PrefService* local_state);
@@ -202,12 +205,9 @@ void PrefetchObserver::OnStartResolution(
NavigatingTo(request_info.hostname());
- // TODO(eroman): If the resolve request is cancelled, then
- // OnFinishResolutionWithStatus will not be called, and |resolutions| will
- // grow unbounded!
- // http://crbug.com/14138
-
AutoLock auto_lock(*lock);
+ // This entry will be deleted either by OnFinishResolutionWithStatus(), or
+ // by OnCancelResolution().
(*resolutions)[request_id] = navigation_info;
}
@@ -240,6 +240,22 @@ void PrefetchObserver::OnFinishResolutionWithStatus(
StartupListAppend(navigation_info);
}
+void PrefetchObserver::OnCancelResolution(
+ int request_id,
+ const net::HostResolver::RequestInfo& request_info) {
+ if (request_info.is_speculative())
+ return; // One of our own requests.
+
+ // Remove the entry from |resolutions| that was added by OnStartResolution().
+ AutoLock auto_lock(*lock);
+ ObservedResolutionMap::iterator it = resolutions->find(request_id);
+ if (resolutions->end() == it) {
+ DCHECK(false);
+ return;
+ }
+ resolutions->erase(it);
+}
+
// static
void PrefetchObserver::StartupListAppend(const DnsHostInfo& navigation_info) {
if (!on_the_record_switch || NULL == dns_master)