| Index: net/dns/host_resolver.h
|
| diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h
|
| index 5c371e43ad533e66ed0f366c36f5f17bb73e1bf7..c5494b7a68e63a7d40b221e02b9bddf4cc3f895a 100644
|
| --- a/net/dns/host_resolver.h
|
| +++ b/net/dns/host_resolver.h
|
| @@ -42,6 +42,18 @@ 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. Can be called after
|
| + // Resolve() is called. Can't be called once the request is cancelled or
|
| + // completed.
|
| + 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 +127,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 +152,21 @@ 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
|
| - // the async request. This handle is not valid after the request has
|
| - // completed.
|
| + // [out_req] must be owned by a caller. If the request is not completed
|
| + // synchronously, it will be filled with a handle to the request. It must be
|
| + // completed before the HostResolver itself is destroyed.
|
| + //
|
| + // Requests can be cancelled any time by deletion of the [out_req]. Deleting
|
| + // |out_req| will cancel the request, and cause |callback| not to be invoked.
|
| //
|
| // 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
|
|
|