 Chromium Code Reviews
 Chromium Code Reviews Issue 2845113002:
  Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chrome  (Closed)
    
  
    Issue 2845113002:
  Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chrome  (Closed) 
  | Index: chrome/browser/safe_browsing/incident_reporting/platform_state_store.cc | 
| diff --git a/chrome/browser/safe_browsing/incident_reporting/platform_state_store.cc b/chrome/browser/safe_browsing/incident_reporting/platform_state_store.cc | 
| index 8da6f1930fb8eb3b08cadf222148041b1f68de08..813b5374519f4036721608a76512629229355dbe 100644 | 
| --- a/chrome/browser/safe_browsing/incident_reporting/platform_state_store.cc | 
| +++ b/chrome/browser/safe_browsing/incident_reporting/platform_state_store.cc | 
| @@ -16,6 +16,7 @@ | 
| #include "chrome/browser/safe_browsing/incident_reporting/platform_state_store.h" | 
| +#include "base/memory/ptr_util.h" | 
| #include "base/values.h" | 
| #if defined(USE_PLATFORM_STATE_STORE) | 
| @@ -115,8 +116,9 @@ void RestoreFromProtobuf( | 
| base::DictionaryValue* type_dict = nullptr; | 
| if (!value_dict->GetDictionaryWithoutPathExpansion(type_string, | 
| &type_dict)) { | 
| - type_dict = new base::DictionaryValue(); | 
| - value_dict->SetWithoutPathExpansion(type_string, type_dict); | 
| + value_dict->SetWithoutPathExpansion( | 
| + type_string, base::MakeUnique<base::DictionaryValue>()); | 
| + value_dict->GetDictionaryWithoutPathExpansion(type_string, &type_dict); | 
| 
jdoerrie
2017/04/27 15:50:29
While the call to GetWithoutPathExpansion is not s
 
Nico
2017/04/27 15:58:25
That seems kind of inefficient, maybe SetWithoutPa
 
jdoerrie
2017/04/27 16:09:31
I made a similar suggestion when doing the ListVal
 
brettw
2017/04/27 21:54:11
I'm happy to treat this like std::map::insert and
 | 
| } | 
| RestoreOfTypeFromProtobuf(type_incidents.incidents().key_to_digest(), | 
| type_dict); |