diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 19:45:39 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 19:45:39 +0000 |
commit | 3f6007ab1f6075c31dc23b5ded198f22a3d08bae (patch) | |
tree | 3337276b3407ff0dd3ac9edad909a8a2ffd37cbf /net/dns | |
parent | e98b970ce84ca3bccbf34985de1c663367ec4412 (diff) | |
download | chromium_src-3f6007ab1f6075c31dc23b5ded198f22a3d08bae.zip chromium_src-3f6007ab1f6075c31dc23b5ded198f22a3d08bae.tar.gz chromium_src-3f6007ab1f6075c31dc23b5ded198f22a3d08bae.tar.bz2 |
Refactor socket pool handling of priorities
Move the priority from the socket param classes to their respective
ConnectJob implementations. This prevents the possibility of
mismatching priorities when socket params have member variables of
other socket param types.
Add tests for priority propagation.
BUG=166689
R=mmenke@chromium.org
Review URL: https://codereview.chromium.org/22818010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns')
-rw-r--r-- | net/dns/mock_host_resolver.cc | 4 | ||||
-rw-r--r-- | net/dns/mock_host_resolver.h | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc index 703309a..a1d46d0 100644 --- a/net/dns/mock_host_resolver.cc +++ b/net/dns/mock_host_resolver.cc @@ -73,6 +73,7 @@ int MockHostResolverBase::Resolve(const RequestInfo& info, RequestHandle* handle, const BoundNetLog& net_log) { DCHECK(CalledOnValidThread()); + last_request_priority_ = priority; num_resolve_++; size_t id = next_request_id_++; int rv = ResolveFromIPLiteralOrCache(info, addresses); @@ -136,7 +137,8 @@ void MockHostResolverBase::ResolveAllPending() { // start id from 1 to distinguish from NULL RequestHandle MockHostResolverBase::MockHostResolverBase(bool use_caching) - : synchronous_mode_(false), + : last_request_priority_(DEFAULT_PRIORITY), + synchronous_mode_(false), ondemand_mode_(false), next_request_id_(1), num_resolve_(0), diff --git a/net/dns/mock_host_resolver.h b/net/dns/mock_host_resolver.h index 691b49c..3593fbd 100644 --- a/net/dns/mock_host_resolver.h +++ b/net/dns/mock_host_resolver.h @@ -105,6 +105,12 @@ class MockHostResolverBase : public HostResolver, return num_resolve_from_cache_; } + // Returns the RequestPriority of the last call to Resolve() (or + // DEFAULT_PRIORITY if Resolve() hasn't been called yet). + RequestPriority last_request_priority() const { + return last_request_priority_; + } + protected: explicit MockHostResolverBase(bool use_caching); @@ -121,6 +127,7 @@ class MockHostResolverBase : public HostResolver, // Resolve request stored in |requests_|. Pass rv to callback. void ResolveNow(size_t id); + RequestPriority last_request_priority_; bool synchronous_mode_; bool ondemand_mode_; scoped_refptr<RuleBasedHostResolverProc> rules_; |