Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3718)

Unified Diff: chrome/browser/intranet_redirect_detector.cc

Issue 2442953002: Remove stl_util's deletion function use from chrome/. (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/intranet_redirect_detector.cc
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc
index 3f2a7f990a47d0fd7c39431ef5d7be823f323dac..a4dfed60902facb865cade3043271764d3472e84 100644
--- a/chrome/browser/intranet_redirect_detector.cc
+++ b/chrome/browser/intranet_redirect_detector.cc
@@ -48,7 +48,6 @@ IntranetRedirectDetector::IntranetRedirectDetector()
IntranetRedirectDetector::~IntranetRedirectDetector() {
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
- base::STLDeleteElements(&fetchers_);
}
// static
@@ -68,7 +67,7 @@ void IntranetRedirectDetector::FinishSleep() {
in_sleep_ = false;
// If another fetch operation is still running, cancel it.
- base::STLDeleteElements(&fetchers_);
+ fetchers_.clear();
resulting_origins_.clear();
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
@@ -85,9 +84,8 @@ void IntranetRedirectDetector::FinishSleep() {
for (int j = 0; j < num_chars; ++j)
url_string += ('a' + base::RandInt(0, 'z' - 'a'));
GURL random_url(url_string + '/');
- net::URLFetcher* fetcher =
- net::URLFetcher::Create(random_url, net::URLFetcher::HEAD, this)
- .release();
+ std::unique_ptr<net::URLFetcher> fetcher =
+ net::URLFetcher::Create(random_url, net::URLFetcher::HEAD, this);
// We don't want these fetches to affect existing state in the profile.
fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE |
net::LOAD_DO_NOT_SAVE_COOKIES |
@@ -95,18 +93,18 @@ void IntranetRedirectDetector::FinishSleep() {
net::LOAD_DO_NOT_SEND_AUTH_DATA);
fetcher->SetRequestContext(g_browser_process->system_request_context());
fetcher->Start();
- fetchers_.insert(fetcher);
+ net::URLFetcher* fetcher_ptr = fetcher.get();
+ fetchers_[fetcher_ptr] = std::move(fetcher);
}
}
void IntranetRedirectDetector::OnURLFetchComplete(
const net::URLFetcher* source) {
// Delete the fetcher on this function's exit.
- Fetchers::iterator fetcher = fetchers_.find(
- const_cast<net::URLFetcher*>(source));
- DCHECK(fetcher != fetchers_.end());
- std::unique_ptr<net::URLFetcher> clean_up_fetcher(*fetcher);
- fetchers_.erase(fetcher);
+ auto it = fetchers_.find(const_cast<net::URLFetcher*>(source));
+ DCHECK(it != fetchers_.end());
+ std::unique_ptr<net::URLFetcher> fetcher = std::move(it->second);
+ fetchers_.erase(it);
// If any two fetches result in the same domain/host, we set the redirect
// origin to that; otherwise we set it to nothing.
@@ -133,7 +131,6 @@ void IntranetRedirectDetector::OnURLFetchComplete(
if (!fetchers_.empty()) {
// Cancel remaining fetch, we don't need it.
DCHECK(fetchers_.size() == 1);
- delete (*fetchers_.begin());
fetchers_.clear();
}
}
« no previous file with comments | « chrome/browser/intranet_redirect_detector.h ('k') | chrome/browser/password_manager/password_store_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698