| Index: net/dns/host_resolver_impl.cc
|
| diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
|
| index a224b8c4e38a87d943fef29f7494c738186e1096..5559c8d460fbbed748f66146ac784f2d8e1cf9d7 100644
|
| --- a/net/dns/host_resolver_impl.cc
|
| +++ b/net/dns/host_resolver_impl.cc
|
| @@ -574,6 +574,7 @@ class HostResolverImpl::Request {
|
| }
|
|
|
| RequestPriority priority() const { return priority_; }
|
| + void set_priority(RequestPriority priority) { priority_ = priority; }
|
|
|
| base::TimeTicks request_time() const { return request_time_; }
|
|
|
| @@ -583,8 +584,7 @@ class HostResolverImpl::Request {
|
| // The request info that started the request.
|
| const RequestInfo info_;
|
|
|
| - // TODO(akalin): Support reprioritization.
|
| - const RequestPriority priority_;
|
| + RequestPriority priority_;
|
|
|
| // The resolve job that this request is dependent on.
|
| Job* job_;
|
| @@ -1367,6 +1367,16 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job,
|
| UpdatePriority();
|
| }
|
|
|
| + void ChangeRequestPriority(Request* req, RequestPriority priority) {
|
| + DCHECK_EQ(key_.hostname, req->info().hostname());
|
| + DCHECK(!req->was_canceled());
|
| +
|
| + priority_tracker_.Remove(req->priority());
|
| + req->set_priority(priority);
|
| + priority_tracker_.Add(req->priority());
|
| + UpdatePriority();
|
| + }
|
| +
|
| // Marks |req| as cancelled. If it was the last active Request, also finishes
|
| // this Job, marking it as cancelled, and deletes it.
|
| void CancelRequest(Request* req) {
|
| @@ -1474,6 +1484,12 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job,
|
| DCHECK_EQ(1u, num_occupied_job_slots_);
|
| }
|
|
|
| + AddressList MakeAddressListForRequest(const AddressList& list) const {
|
| + if (requests_.empty())
|
| + return list;
|
| + return AddressList::CopyWithPort(list, requests_.front()->info().port());
|
| + }
|
| +
|
| void UpdatePriority() {
|
| if (is_queued()) {
|
| if (priority() != static_cast<RequestPriority>(handle_.priority()))
|
| @@ -1482,12 +1498,6 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job,
|
| }
|
| }
|
|
|
| - AddressList MakeAddressListForRequest(const AddressList& list) const {
|
| - if (requests_.empty())
|
| - return list;
|
| - return AddressList::CopyWithPort(list, requests_.front()->info().port());
|
| - }
|
| -
|
| // PriorityDispatch::Job:
|
| void Start() override {
|
| DCHECK_LE(num_occupied_job_slots_, 1u);
|
| @@ -2045,6 +2055,16 @@ int HostResolverImpl::ResolveFromCache(const RequestInfo& info,
|
| return rv;
|
| }
|
|
|
| +void HostResolverImpl::ChangeRequestPriority(RequestHandle req_handle,
|
| + RequestPriority priority) {
|
| + DCHECK(CalledOnValidThread());
|
| + Request* req = reinterpret_cast<Request*>(req_handle);
|
| + DCHECK(req);
|
| + Job* job = req->job();
|
| + DCHECK(job);
|
| + job->ChangeRequestPriority(req, priority);
|
| +}
|
| +
|
| void HostResolverImpl::CancelRequest(RequestHandle req_handle) {
|
| DCHECK(CalledOnValidThread());
|
| Request* req = reinterpret_cast<Request*>(req_handle);
|
|
|