Chromium Code Reviews| Index: net/dns/host_resolver.h |
| diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h |
| index 5c371e43ad533e66ed0f366c36f5f17bb73e1bf7..1b30c0b9ec7af187bb8a39f3d7b7946ea47f9b33 100644 |
| --- a/net/dns/host_resolver.h |
| +++ b/net/dns/host_resolver.h |
| @@ -42,6 +42,20 @@ class NetLog; |
| // goes out of scope). |
| class NET_EXPORT HostResolver { |
| public: |
| + // HostResolver::Request class is used to cancel the request and change it's |
| + // priority. It must be owned by consumer. Deletion cancels the request. |
| + class Request { |
| + public: |
| + virtual ~Request() {} |
| + |
| + // Changes the priority of the specified request. |req| is the handle |
| + // returned |
| + // by Resolve(). ChangeRequestPriority must NOT be called after the |
| + // request's |
| + // completion callback has already run or the request was canceled. |
|
mmenke
2016/07/19 19:03:55
This comment is outdated (There is no |req| or spe
maksims (do not use this acc)
2016/07/21 07:12:45
Done.
|
| + virtual void ChangeRequestPriority(RequestPriority priority) = 0; |
| + }; |
| + |
| // |max_concurrent_resolves| is how many resolve requests will be allowed to |
| // run in parallel. Pass HostResolver::kDefaultParallelism to choose a |
| // default value. |
| @@ -115,9 +129,6 @@ class NET_EXPORT HostResolver { |
| bool is_my_ip_address_; |
| }; |
| - // Opaque type used to cancel a request. |
| - typedef void* RequestHandle; |
| - |
| // Set Options.max_concurrent_resolves to this to select a default level |
| // of concurrency. |
| static const size_t kDefaultParallelism = 0; |
| @@ -143,30 +154,26 @@ class NET_EXPORT HostResolver { |
| // callback. Otherwise the result code is returned immediately from this |
| // call. |
| // |
| - // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to |
| + // |out_req| is non-NULL, then |*out_req| will be filled with a handle to |
| // the async request. This handle is not valid after the request has |
| // completed. |
| // |
| + // [out_req] must be owned by a caller. When Resolve() is called, the request |
| + // is filled with a request handle and attached to a job. After the request |
| + // has completed, [out_req] is detached from the job. |
|
mmenke
2016/07/19 19:03:55
job is an internal implementation detail of the Ho
maksims (do not use this acc)
2016/07/21 07:12:45
Requests can even be cancelled after the HostResol
|
| + // |
| + // Requests can be cancelled any time during a resolve job by deletion of the |
| + // [out_req]. If it is deleted before Resolve() has completed it's job, the |
| + // request will not be completed. |
|
mmenke
2016/07/19 19:03:55
Maybe delete "during a resolve job", and remove th
maksims (do not use this acc)
2016/07/21 07:12:45
Done.
|
| + // |
| // Profiling information for the request is saved to |net_log| if non-NULL. |
| virtual int Resolve(const RequestInfo& info, |
| RequestPriority priority, |
| AddressList* addresses, |
| const CompletionCallback& callback, |
| - RequestHandle* out_req, |
| + std::unique_ptr<Request>* out_req, |
| const BoundNetLog& net_log) = 0; |
| - // Changes the priority of the specified request. |req| is the handle returned |
| - // by Resolve(). ChangeRequestPriority must NOT be called after the request's |
| - // completion callback has already run or the request was canceled. |
| - virtual void ChangeRequestPriority(RequestHandle req, |
| - RequestPriority priority); |
| - |
| - // Cancels the specified request. |req| is the handle returned by Resolve(). |
| - // After a request is canceled, its completion callback will not be called. |
| - // CancelRequest must NOT be called after the request's completion callback |
| - // has already run or the request was canceled. |
| - virtual void CancelRequest(RequestHandle req) = 0; |
| - |
| // Resolves the given hostname (or IP address literal) out of cache or HOSTS |
| // file (if enabled) only. This is guaranteed to complete synchronously. |
| // This acts like |Resolve()| if the hostname is IP literal, or cached value |