-
vabr authored
ProxyConfigDictionary uses raw pointers to DictionaryValue to pass ownership. This CL changes that to unique_ptr: * to improve code clarity * to go one step towards removing the obsolete raw-pointer-based API of base::Value, and * to fix a leak in ProxyConfigServiceImpl::GetActiveProxyConfigDictionary. The problem with ProxyConfigServiceImpl::GetActiveProxyConfigDictionary was the line: return base::MakeUnique<ProxyConfigDictionary>( ProxyConfigDictionary::CreateDirect()); In the old code, CreateDirect() would return an owning raw pointer, but the ProxyConfigDictionary constructor would only make a Value::DeepCopy of it and let it be, never freeing that memory. This CL fixes the issue by switching the result of CreateDirect to be a unique_ptr. One way to do that would to do return base::MakeUnique<ProxyConfigDictionary>( ProxyConfigDictionary::CreateDirect().get()); but that would be an unnecessary copy. Instead, this CL added a version of the ProxyConfigDictionary constructor which accepts a unique_ptr and avoids the copy. As a side effect, that particular line in GetActiveProxyConfigDictionary did not have to be changed at all. BUG=697817 TBR=bartfab@chromium.org Review-Url: https://codereview.chromium.org/2785883003 Cr-Commit-Position: refs/heads/master@{#461076}
6f6e2669