| Index: net/proxy/dhcp_proxy_script_fetcher_win.cc
|
| diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc
|
| index 54e2bdfcb7104632a3c678694f52e1c500b4bbc0..23c59ee703b050b792e3e236ac74c57600dd160e 100644
|
| --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc
|
| +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc
|
| @@ -45,11 +45,9 @@ const int kMaxDhcpLookupThreads = 12;
|
| const int kMaxWaitAfterFirstResultMs = 400;
|
|
|
| const int kGetAdaptersAddressesErrors[] = {
|
| - ERROR_ADDRESS_NOT_ASSOCIATED,
|
| - ERROR_BUFFER_OVERFLOW,
|
| - ERROR_INVALID_PARAMETER,
|
| - ERROR_NOT_ENOUGH_MEMORY,
|
| - ERROR_NO_DATA,
|
| + ERROR_ADDRESS_NOT_ASSOCIATED, ERROR_BUFFER_OVERFLOW,
|
| + ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY,
|
| + ERROR_NO_DATA,
|
| };
|
|
|
| } // namespace
|
| @@ -64,8 +62,8 @@ DhcpProxyScriptFetcherWin::DhcpProxyScriptFetcherWin(
|
| url_request_context_(url_request_context) {
|
| DCHECK(url_request_context_);
|
|
|
| - worker_pool_ = new base::SequencedWorkerPool(kMaxDhcpLookupThreads,
|
| - "PacDhcpLookup");
|
| + worker_pool_ =
|
| + new base::SequencedWorkerPool(kMaxDhcpLookupThreads, "PacDhcpLookup");
|
| }
|
|
|
| DhcpProxyScriptFetcherWin::~DhcpProxyScriptFetcherWin() {
|
| @@ -95,10 +93,9 @@ int DhcpProxyScriptFetcherWin::Fetch(base::string16* utf16_text,
|
| base::Bind(
|
| &DhcpProxyScriptFetcherWin::AdapterQuery::GetCandidateAdapterNames,
|
| last_query_.get()),
|
| - base::Bind(
|
| - &DhcpProxyScriptFetcherWin::OnGetCandidateAdapterNamesDone,
|
| - AsWeakPtr(),
|
| - last_query_));
|
| + base::Bind(&DhcpProxyScriptFetcherWin::OnGetCandidateAdapterNamesDone,
|
| + AsWeakPtr(),
|
| + last_query_));
|
|
|
| return ERR_IO_PENDING;
|
| }
|
| @@ -124,8 +121,7 @@ void DhcpProxyScriptFetcherWin::CancelImpl() {
|
| wait_timer_.Stop();
|
| state_ = STATE_DONE;
|
|
|
| - for (FetcherVector::iterator it = fetchers_.begin();
|
| - it != fetchers_.end();
|
| + for (FetcherVector::iterator it = fetchers_.begin(); it != fetchers_.end();
|
| ++it) {
|
| (*it)->Cancel();
|
| }
|
| @@ -165,9 +161,9 @@ void DhcpProxyScriptFetcherWin::OnGetCandidateAdapterNamesDone(
|
| it != adapter_names.end();
|
| ++it) {
|
| DhcpProxyScriptAdapterFetcher* fetcher(ImplCreateAdapterFetcher());
|
| - fetcher->Fetch(
|
| - *it, base::Bind(&DhcpProxyScriptFetcherWin::OnFetcherDone,
|
| - base::Unretained(this)));
|
| + fetcher->Fetch(*it,
|
| + base::Bind(&DhcpProxyScriptFetcherWin::OnFetcherDone,
|
| + base::Unretained(this)));
|
| fetchers_.push_back(fetcher);
|
| }
|
| num_pending_fetchers_ = fetchers_.size();
|
| @@ -195,8 +191,7 @@ void DhcpProxyScriptFetcherWin::OnFetcherDone(int result) {
|
|
|
| // If the only pending adapters are those less preferred than one
|
| // with a valid PAC script, we do not need to wait any longer.
|
| - for (FetcherVector::iterator it = fetchers_.begin();
|
| - it != fetchers_.end();
|
| + for (FetcherVector::iterator it = fetchers_.begin(); it != fetchers_.end();
|
| ++it) {
|
| bool did_finish = (*it)->DidFinish();
|
| int result = (*it)->GetResult();
|
| @@ -214,7 +209,9 @@ void DhcpProxyScriptFetcherWin::OnFetcherDone(int result) {
|
| if (state_ == STATE_NO_RESULTS) {
|
| state_ = STATE_SOME_RESULTS;
|
| wait_timer_.Start(FROM_HERE,
|
| - ImplGetMaxWait(), this, &DhcpProxyScriptFetcherWin::OnWaitTimer);
|
| + ImplGetMaxWait(),
|
| + this,
|
| + &DhcpProxyScriptFetcherWin::OnWaitTimer);
|
| }
|
| }
|
|
|
| @@ -241,8 +238,7 @@ void DhcpProxyScriptFetcherWin::TransitionToDone() {
|
| // preferring "real" network errors to the ERR_PAC_NOT_IN_DHCP error.
|
| // Default to ERR_ABORTED if no fetcher completed.
|
| result = ERR_ABORTED;
|
| - for (FetcherVector::iterator it = fetchers_.begin();
|
| - it != fetchers_.end();
|
| + for (FetcherVector::iterator it = fetchers_.begin(); it != fetchers_.end();
|
| ++it) {
|
| if ((*it)->DidFinish() && (*it)->GetResult() == OK) {
|
| result = OK;
|
| @@ -298,13 +294,13 @@ scoped_refptr<base::TaskRunner> DhcpProxyScriptFetcherWin::GetTaskRunner() {
|
| }
|
|
|
| DhcpProxyScriptAdapterFetcher*
|
| - DhcpProxyScriptFetcherWin::ImplCreateAdapterFetcher() {
|
| +DhcpProxyScriptFetcherWin::ImplCreateAdapterFetcher() {
|
| return new DhcpProxyScriptAdapterFetcher(url_request_context_,
|
| GetTaskRunner());
|
| }
|
|
|
| DhcpProxyScriptFetcherWin::AdapterQuery*
|
| - DhcpProxyScriptFetcherWin::ImplCreateAdapterQuery() {
|
| +DhcpProxyScriptFetcherWin::ImplCreateAdapterQuery() {
|
| return new AdapterQuery();
|
| }
|
|
|
| @@ -328,14 +324,13 @@ bool DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(
|
| do {
|
| adapters.reset(static_cast<IP_ADAPTER_ADDRESSES*>(malloc(adapters_size)));
|
| // Return only unicast addresses, and skip information we do not need.
|
| - error = GetAdaptersAddresses(AF_UNSPEC,
|
| - GAA_FLAG_SKIP_ANYCAST |
|
| - GAA_FLAG_SKIP_MULTICAST |
|
| - GAA_FLAG_SKIP_DNS_SERVER |
|
| - GAA_FLAG_SKIP_FRIENDLY_NAME,
|
| - NULL,
|
| - adapters.get(),
|
| - &adapters_size);
|
| + error = GetAdaptersAddresses(
|
| + AF_UNSPEC,
|
| + GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
|
| + GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME,
|
| + NULL,
|
| + adapters.get(),
|
| + &adapters_size);
|
| ++num_tries;
|
| } while (error == ERROR_BUFFER_OVERFLOW && num_tries <= 3);
|
|
|
| @@ -388,7 +383,7 @@ void DhcpProxyScriptFetcherWin::AdapterQuery::GetCandidateAdapterNames() {
|
| }
|
|
|
| const std::set<std::string>&
|
| - DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const {
|
| +DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const {
|
| return adapter_names_;
|
| }
|
|
|
|
|