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

Unified Diff: net/proxy/proxy_config_service_win.cc

Issue 2391453002: Remove stl_util's deletion functions from net/proxy/. (Closed)
Patch Set: fixes 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
« no previous file with comments | « net/proxy/proxy_config_service_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_service_win.cc
diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc
index 0edc5233188fac3f51a6fe395dfb818b2d2b2ad9..6341c61d0ab09c337bc1bddd293af2d446b93916 100644
--- a/net/proxy/proxy_config_service_win.cc
+++ b/net/proxy/proxy_config_service_win.cc
@@ -12,7 +12,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -46,10 +46,10 @@ ProxyConfigServiceWin::ProxyConfigServiceWin()
}
ProxyConfigServiceWin::~ProxyConfigServiceWin() {
- // The registry functions below will end up going to disk. Do this on another
- // thread to avoid slowing the IO thread. http://crbug.com/61453
+ // The registry functions below will end up going to disk. TODO: Do this on
+ // another thread to avoid slowing the IO thread. http://crbug.com/61453
base::ThreadRestrictions::ScopedAllowIO allow_io;
- base::STLDeleteElements(&keys_to_watch_);
+ keys_to_watch_.clear();
}
void ProxyConfigServiceWin::AddObserver(Observer* observer) {
@@ -96,7 +96,8 @@ void ProxyConfigServiceWin::StartWatchingRegistryForChanges() {
bool ProxyConfigServiceWin::AddKeyToWatchList(HKEY rootkey,
const wchar_t* subkey) {
- std::unique_ptr<base::win::RegKey> key(new base::win::RegKey);
+ std::unique_ptr<base::win::RegKey> key =
+ base::MakeUnique<base::win::RegKey>();
if (key->Create(rootkey, subkey, KEY_NOTIFY) != ERROR_SUCCESS)
return false;
@@ -106,21 +107,22 @@ bool ProxyConfigServiceWin::AddKeyToWatchList(HKEY rootkey,
return false;
}
- keys_to_watch_.push_back(key.release());
+ keys_to_watch_.push_back(std::move(key));
return true;
}
void ProxyConfigServiceWin::OnObjectSignaled(base::win::RegKey* key) {
// Figure out which registry key signalled this change.
- RegKeyList::iterator it =
- std::find(keys_to_watch_.begin(), keys_to_watch_.end(), key);
+ auto it = std::find_if(keys_to_watch_.begin(), keys_to_watch_.end(),
+ [key](const std::unique_ptr<base::win::RegKey>& ptr) {
+ return ptr.get() == key;
+ });
DCHECK(it != keys_to_watch_.end());
// Keep watching the registry key.
if (!key->StartWatching(base::Bind(&ProxyConfigServiceWin::OnObjectSignaled,
base::Unretained(this),
base::Unretained(key)))) {
- delete *it;
keys_to_watch_.erase(it);
}
« no previous file with comments | « net/proxy/proxy_config_service_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698