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

Unified Diff: content/common/font_list_mac.mm

Issue 2817603003: Remove ListValue::Append(raw ptr) on Mac and iOS (Closed)
Patch Set: Fix even more Mac 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: content/common/font_list_mac.mm
diff --git a/content/common/font_list_mac.mm b/content/common/font_list_mac.mm
index 5eebf2c05c129482170504c665354710ca9622e9..ff5ad8cf7a692e2c585be14386794206b326add7 100644
--- a/content/common/font_list_mac.mm
+++ b/content/common/font_list_mac.mm
@@ -6,7 +6,10 @@
#import <Cocoa/Cocoa.h>
+#include <utility>
+
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
@@ -31,12 +34,12 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() {
for (NSString* family_name in sortedFonts) {
NSString* localized_family_name = fonts_dict[family_name];
- base::ListValue* font_item = new base::ListValue();
+ auto font_item = base::MakeUnique<base::ListValue>();
base::string16 family = base::SysNSStringToUTF16(family_name);
base::string16 loc_family = base::SysNSStringToUTF16(localized_family_name);
- font_item->Append(new base::Value(family));
- font_item->Append(new base::Value(loc_family));
- font_list->Append(font_item);
+ font_item->Append(base::MakeUnique<base::Value>(family));
+ font_item->Append(base::MakeUnique<base::Value>(loc_family));
jdoerrie 2017/04/12 12:37:46 Consider the more compact AppendString, ie: font_
vabr (Chromium) 2017/04/12 12:55:04 Good point, I completely missed the existence of t
+ font_list->Append(std::move(font_item));
}
return font_list;

Powered by Google App Engine
This is Rietveld 408576698