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

Unified Diff: ui/base/models/list_model.h

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 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
« no previous file with comments | « ui/base/l10n/l10n_util_unittest.cc ('k') | ui/base/models/list_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/models/list_model.h
diff --git a/ui/base/models/list_model.h b/ui/base/models/list_model.h
index f8212f22a698e6a0b595e986b363a31d2416b3bf..482468fa291602b2346f450d7d2d5cea5fe4e485 100644
--- a/ui/base/models/list_model.h
+++ b/ui/base/models/list_model.h
@@ -7,11 +7,12 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "ui/base/models/list_model_observer.h"
@@ -41,12 +42,12 @@ class ListModel {
// Removes the item at |index| from |items_| without deleting it.
// Returns a scoped pointer containing the removed item.
- scoped_ptr<ItemType> RemoveAt(size_t index) {
+ std::unique_ptr<ItemType> RemoveAt(size_t index) {
DCHECK_LT(index, item_count());
ItemType* item = items_[index];
items_.weak_erase(items_.begin() + index);
NotifyItemsRemoved(index, 1);
- return make_scoped_ptr<ItemType>(item);
+ return base::WrapUnique<ItemType>(item);
}
// Removes all items from the model. This does NOT delete the items.
@@ -58,7 +59,7 @@ class ListModel {
// Removes the item at |index| from |items_| and deletes it.
void DeleteAt(size_t index) {
- scoped_ptr<ItemType> item = RemoveAt(index);
+ std::unique_ptr<ItemType> item = RemoveAt(index);
// |item| will be deleted on destruction.
}
« no previous file with comments | « ui/base/l10n/l10n_util_unittest.cc ('k') | ui/base/models/list_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698