Commit e5a94e05 authored by Findit's avatar Findit

Revert "Add new ResolveHost API."

This reverts commit fac52799.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 575065 as the
culprit for failures in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2ZhYzUyNzk5YjIzNGIxZDQ4MmEyZDljYjQwNjVhZjFmZDkxMGNkODIM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.linux/Cast%20Audio%20Linux/15781

Sample Failed Step: net_unittests

Original change's description:
> Add new ResolveHost API.
> 
> Primarily an interface-only change. Only change past the interface level
> of the stack was to internally pass rawer information rather than
> use RequestInfo as that struct is specific to the old Resolve API.
> 
> Only handles the basic case for now (HostPortPair input without any
> significant options), but additional funtionality will be added in
> subsequent changes.
> 
> Copy and convert all the unittests that can be implemented using the new
> method with its current basic functionality. If we ever convert all
> usage to the new method and delete the old, we'll be able to cleanly
> delete all the old tests.
> 
> Design doc:
> https://docs.google.com/document/d/1NmADJX00oRe9TxFCJTWl8ofdfyR22pbKT8-5Ad5lBsU
> 
> Bug: 821021
> Cq-Include-Trybots: luci.chromium.try:linux_mojo;master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
> Change-Id: I4fe454761e2930d6f235e8e505b689f8917fdeed
> Reviewed-on: https://chromium-review.googlesource.com/1099427
> Commit-Queue: Eric Orth <ericorth@chromium.org>
> Reviewed-by: Helen Li <xunjieli@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#575065}

Change-Id: Ifa50c76a409dde3580599275aade1686795d6c17
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 821021
Cq-Include-Trybots: luci.chromium.try:linux_mojo;master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Reviewed-on: https://chromium-review.googlesource.com/1137111
Cr-Commit-Position: refs/heads/master@{#575084}
parent 79fd3857
......@@ -381,14 +381,6 @@ StaleHostResolver::StaleHostResolver(
StaleHostResolver::~StaleHostResolver() {}
std::unique_ptr<net::HostResolver::ResolveHostRequest>
StaleHostResolver::CreateRequest(const net::HostPortPair& host,
const net::NetLogWithSource& net_log) {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int StaleHostResolver::Resolve(const RequestInfo& info,
net::RequestPriority priority,
net::AddressList* addresses,
......
......@@ -5,7 +5,6 @@
#ifndef COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_
#define COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_
#include <memory>
#include <unordered_set>
#include "base/time/default_tick_clock.h"
......@@ -62,10 +61,6 @@ class StaleHostResolver : public net::HostResolver {
// HostResolver implementation:
std::unique_ptr<ResolveHostRequest> CreateRequest(
const net::HostPortPair& host,
const net::NetLogWithSource& net_log) override;
// Resolves as a regular HostResolver, but if stale data is available and
// usable (according to the options passed to the constructor), and fresh data
// is not returned before the specified delay, returns the stale data instead.
......
......@@ -10,7 +10,6 @@
#include <memory>
#include <string>
#include <vector>
#include "net/base/address_family.h"
#include "net/base/completion_once_callback.h"
......@@ -46,9 +45,6 @@ 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.
//
// TODO(crbug.com/821021): Delete this class once all usage has been
// converted to the new CreateRequest() API.
class Request {
public:
virtual ~Request() {}
......@@ -59,41 +55,6 @@ class NET_EXPORT HostResolver {
virtual void ChangeRequestPriority(RequestPriority priority) = 0;
};
// Handler for an individual host resolution request. Created by
// HostResolver::CreateRequest().
class ResolveHostRequest {
public:
// Destruction cancels the request if running asynchronously, causing the
// callback to never be invoked.
virtual ~ResolveHostRequest() {}
// Starts the request and returns a network error code.
//
// If the request could not be handled synchronously, returns
// |ERR_IO_PENDING|, and completion will be signaled later via |callback|.
// On any other returned value, the request was handled synchronously and
// |callback| will not be invoked.
//
// Results in ERR_NAME_NOT_RESOLVED if the hostname is invalid, or if it is
// an incompatible IP literal (e.g. IPv6 is disabled and it is an IPv6
// literal).
//
// The parent HostResolver must still be alive when Start() is called, but
// if it is destroyed before an asynchronous result completes, the request
// will be automatically cancelled.
//
// If cancelled before |callback| is invoked, it will never be invoked.
virtual int Start(CompletionOnceCallback callback) = 0;
// Result of the request. Should only be called after Start() signals
// completion, either by invoking the callback or by returning a result
// other than |ERR_IO_PENDING|.
//
// TODO(crbug.com/821021): Implement other GetResults() methods for requests
// that return other data (eg DNS TXT requests).
virtual const base::Optional<AddressList>& GetAddressResults() const = 0;
};
// |max_concurrent_resolves| is how many resolve requests will be allowed to
// run in parallel. Pass HostResolver::kDefaultParallelism to choose a
// default value.
......@@ -183,21 +144,6 @@ class NET_EXPORT HostResolver {
// be called.
virtual ~HostResolver();
// Creates a request to resolve the given hostname (or IP address literal).
// Profiling information for the request is saved to |net_log| if non-NULL.
//
// This method is intended as a direct replacement for the old Resolve()
// method, but it may not yet cover all the capabilities of the old method.
//
// TODO(crbug.com/821021): Implement more complex functionality to meet
// capabilities of Resolve() and M/DnsClient functionality.
virtual std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) = 0;
// DEPRECATION NOTE: This method is being replaced by CreateRequest(). New
// callers should prefer CreateRequest() if it works for their needs.
//
// Resolves the given hostname (or IP address literal), filling out the
// |addresses| object upon success. The |info.port| parameter will be set as
// the sin(6)_port field of the sockaddr_in{6} struct. Returns OK if
......@@ -219,9 +165,6 @@ class NET_EXPORT HostResolver {
// |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.
//
// TODO(crbug.com/821021): Delete this method once all usage has been
// converted to ResolveHost().
virtual int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
This diff is collapsed.
......@@ -10,9 +10,6 @@
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
......@@ -128,6 +125,10 @@ class NET_EXPORT HostResolverImpl
// be called.
~HostResolverImpl() override;
// Configures maximum number of Jobs in the queue. Exposed for testing.
// Only allowed when the queue is empty.
void SetMaxQueuedJobs(size_t value);
// Set the DnsClient to be used for resolution. In case of failure, the
// HostResolverProc from ProcTaskParams will be queried. If the DnsClient is
// not pre-configured with a valid DnsConfig, a new config is fetched from
......@@ -135,9 +136,6 @@ class NET_EXPORT HostResolverImpl
void SetDnsClient(std::unique_ptr<DnsClient> dns_client);
// HostResolver methods:
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override;
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......@@ -181,10 +179,6 @@ class NET_EXPORT HostResolverImpl
void SetTickClockForTesting(const base::TickClock* tick_clock);
// Configures maximum number of Jobs in the queue. Exposed for testing.
// Only allowed when the queue is empty.
void SetMaxQueuedJobsForTesting(size_t value);
protected:
// Callback from HaveOnlyLoopbackAddresses probe.
void SetHaveOnlyLoopbackAddresses(bool result);
......@@ -199,7 +193,6 @@ class NET_EXPORT HostResolverImpl
class LoopbackProbeJob;
class DnsTask;
class RequestImpl;
class LegacyRequestImpl;
using Key = HostCache::Key;
using JobMap = std::map<Key, std::unique_ptr<Job>>;
......@@ -207,14 +200,11 @@ class NET_EXPORT HostResolverImpl
// ProcTask) before the DnsClient is disabled until the next DNS change.
static const unsigned kMaximumDnsFailures;
// Attempts host resolution for |request|. Generally only expected to be
// called from RequestImpl::Start().
int Resolve(RequestImpl* request);
// Attempts host resolution using fast local sources: IP literal resolution,
// cache lookup, HOSTS lookup (if enabled), and localhost. Returns OK if
// successful, ERR_NAME_NOT_RESOLVED if input is invalid, or
// ERR_DNS_CACHE_MISS if the host could not be resolved using local sources.
// Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP
// literal, cache and HOSTS lookup (if enabled), returns OK if successful,
// ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is
// incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache and
// HOSTS and is not localhost.
//
// On success, the resulting addresses are written to |addresses|.
//
......@@ -227,25 +217,17 @@ class NET_EXPORT HostResolverImpl
//
// If |allow_stale| is false, then stale cache entries will not be returned,
// and |stale_info| must be null.
int ResolveLocally(const HostPortPair& host,
AddressFamily requested_address_family,
HostResolverFlags flags,
bool allow_cache,
bool allow_stale,
HostCache::EntryStaleness* stale_info,
const NetLogWithSource& request_net_log,
AddressList* addresses,
Key* key);
// Attempts to create and start a Job to asynchronously attempt to resolve
// |key|. On success, returns ERR_IO_PENDING and attaches the Job to
// |request|. On error, marks |request| completed and returns the error.
int CreateAndStartJob(const Key& key, RequestImpl* request);
int ResolveHelper(const RequestInfo& info,
bool allow_stale,
HostCache::EntryStaleness* stale_info,
const NetLogWithSource& request_net_log,
AddressList* addresses,
Key* key);
// Tries to resolve |key| as an IP, returns true and sets |net_error| if
// succeeds, returns false otherwise.
bool ResolveAsIP(const Key& key,
uint16_t host_port,
const RequestInfo& info,
const IPAddress* ip_address,
int* net_error,
AddressList* addresses);
......@@ -261,7 +243,7 @@ class NET_EXPORT HostResolverImpl
// If |allow_stale| is false, then stale cache entries will not be returned,
// and |stale_info| must be null.
bool ServeFromCache(const Key& key,
uint16_t host_port,
const RequestInfo& info,
int* net_error,
AddressList* addresses,
bool allow_stale,
......@@ -270,21 +252,19 @@ class NET_EXPORT HostResolverImpl
// If we have a DnsClient with a valid DnsConfig, and |key| is found in the
// HOSTS file, returns true and fills |addresses|. Otherwise returns false.
bool ServeFromHosts(const Key& key,
uint16_t host_port,
const RequestInfo& info,
AddressList* addresses);
// If |key| is for a localhost name (RFC 6761), returns true and fills
// |addresses| with the loopback IP. Otherwise returns false.
bool ServeLocalhost(const Key& key,
uint16_t host_port,
const RequestInfo& info,
AddressList* addresses);
// Returns the (hostname, address_family) key to use for |info|, choosing an
// "effective" address family by inheriting the resolver's default address
// family when the request leaves it unspecified.
Key GetEffectiveKeyForRequest(const std::string& hostname,
AddressFamily requested_address_family,
HostResolverFlags flags,
Key GetEffectiveKeyForRequest(const RequestInfo& info,
const IPAddress* ip_address,
const NetLogWithSource& net_log);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -70,14 +70,6 @@ HostResolverMojo::HostResolverMojo(Impl* impl)
HostResolverMojo::~HostResolverMojo() = default;
std::unique_ptr<HostResolver::ResolveHostRequest>
HostResolverMojo::CreateRequest(const HostPortPair& host,
const NetLogWithSource& source_net_log) {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int HostResolverMojo::Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -5,8 +5,6 @@
#ifndef NET_DNS_HOST_RESOLVER_MOJO_H_
#define NET_DNS_HOST_RESOLVER_MOJO_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
......@@ -36,9 +34,6 @@ class HostResolverMojo : public HostResolver {
~HostResolverMojo() override;
// HostResolver overrides.
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override;
// Note: |Resolve()| currently ignores |priority|.
int Resolve(const RequestInfo& info,
RequestPriority priority,
......
......@@ -18,14 +18,6 @@ MappedHostResolver::MappedHostResolver(std::unique_ptr<HostResolver> impl)
MappedHostResolver::~MappedHostResolver() = default;
std::unique_ptr<HostResolver::ResolveHostRequest>
MappedHostResolver::CreateRequest(const HostPortPair& host,
const NetLogWithSource& source_net_log) {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int MappedHostResolver::Resolve(const RequestInfo& original_info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -46,9 +46,6 @@ class NET_EXPORT MappedHostResolver : public HostResolver {
}
// HostResolver methods:
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override;
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -103,14 +103,6 @@ MockHostResolverBase::~MockHostResolverBase() {
DCHECK(requests_.empty());
}
std::unique_ptr<HostResolver::ResolveHostRequest>
MockHostResolverBase::CreateRequest(const HostPortPair& host,
const NetLogWithSource& source_net_log) {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int MockHostResolverBase::Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......@@ -522,14 +514,6 @@ RuleBasedHostResolverProc* CreateCatchAllHostResolverProc() {
//-----------------------------------------------------------------------------
std::unique_ptr<HostResolver::ResolveHostRequest>
HangingHostResolver::CreateRequest(const HostPortPair& host,
const NetLogWithSource& source_net_log) {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int HangingHostResolver::Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -9,7 +9,6 @@
#include <list>
#include <map>
#include <memory>
#include <string>
#include "base/macros.h"
......@@ -84,9 +83,6 @@ class MockHostResolverBase
}
// HostResolver methods:
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override;
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......@@ -291,9 +287,6 @@ RuleBasedHostResolverProc* CreateCatchAllHostResolverProc();
// HangingHostResolver never completes its |Resolve| request.
class HangingHostResolver : public HostResolver {
public:
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override;
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -693,13 +693,6 @@ class BlockableHostResolver : public HostResolver {
BlockableHostResolver()
: num_cancelled_requests_(0), waiting_for_resolve_(false) {}
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override {
NOTIMPLEMENTED();
return nullptr;
}
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -790,13 +790,6 @@ class BlockableHostResolver : public HostResolver {
BlockableHostResolver()
: num_cancelled_requests_(0), waiting_for_resolve_(false) {}
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override {
NOTIMPLEMENTED();
return nullptr;
}
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -107,13 +107,6 @@ class HangingHostResolverWithCancel : public HostResolver {
public:
HangingHostResolverWithCancel() : outstanding_request_(NULL) {}
std::unique_ptr<ResolveHostRequest> CreateRequest(
const HostPortPair& host,
const NetLogWithSource& net_log) override {
NOTIMPLEMENTED();
return nullptr;
}
int Resolve(const RequestInfo& info,
RequestPriority priority,
AddressList* addresses,
......
......@@ -478,14 +478,6 @@ class MockHostResolver : public net::HostResolver {
};
// net::HostResolver overrides.
std::unique_ptr<HostResolver::ResolveHostRequest> CreateRequest(
const net::HostPortPair& host,
const net::NetLogWithSource& source_net_log) override {
// TODO(crbug.com/821021): Implement.
NOTIMPLEMENTED();
return nullptr;
}
int Resolve(const RequestInfo& info,
net::RequestPriority priority,
net::AddressList* addresses,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment