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

Unified Diff: chrome/browser/ui/browser_window_state.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble Created 3 years, 8 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/ui/browser_window_state.cc
diff --git a/chrome/browser/ui/browser_window_state.cc b/chrome/browser/ui/browser_window_state.cc
index e7eb1923632561cf30d5d02fa0bad2b09843e7b8..54f3544c32cf78f42ed58861a29041652289e99a 100644
--- a/chrome/browser/ui/browser_window_state.cc
+++ b/chrome/browser/ui/browser_window_state.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
+#include <utility>
+
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -56,12 +58,13 @@ class WindowPlacementPrefUpdate : public DictionaryPrefUpdate {
base::DictionaryValue* Get() override {
base::DictionaryValue* all_apps_dict = DictionaryPrefUpdate::Get();
- base::DictionaryValue* this_app_dict = NULL;
- if (!all_apps_dict->GetDictionary(window_name_, &this_app_dict)) {
- this_app_dict = new base::DictionaryValue;
- all_apps_dict->Set(window_name_, this_app_dict);
+ base::DictionaryValue* this_app_dict_weak = NULL;
+ if (!all_apps_dict->GetDictionary(window_name_, &this_app_dict_weak)) {
+ auto this_app_dict = base::MakeUnique<base::DictionaryValue>();
+ this_app_dict_weak = this_app_dict.get();
+ all_apps_dict->Set(window_name_, std::move(this_app_dict));
}
- return this_app_dict;
+ return this_app_dict_weak;
}
private:

Powered by Google App Engine
This is Rietveld 408576698