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

Side by Side Diff: ui/base/models/list_model.h

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update location_bar_view_mac.mm Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.cc ('k') | ui/base/models/tree_node_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_BASE_MODELS_LIST_MODEL_H_ 5 #ifndef UI_BASE_MODELS_LIST_MODEL_H_
6 #define UI_BASE_MODELS_LIST_MODEL_H_ 6 #define UI_BASE_MODELS_LIST_MODEL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 29 matching lines...) Expand all
40 DCHECK_LT(index, item_count()); 40 DCHECK_LT(index, item_count());
41 ItemType* item = items_[index]; 41 ItemType* item = items_[index];
42 items_.weak_erase(items_.begin() + index); 42 items_.weak_erase(items_.begin() + index);
43 NotifyItemsRemoved(index, 1); 43 NotifyItemsRemoved(index, 1);
44 return item; 44 return item;
45 } 45 }
46 46
47 // Removes all items from the model. This does NOT delete the items. 47 // Removes all items from the model. This does NOT delete the items.
48 void RemoveAll() { 48 void RemoveAll() {
49 size_t count = item_count(); 49 size_t count = item_count();
50 items_.clear(); 50 items_.weak_clear();
51 NotifyItemsRemoved(0, count); 51 NotifyItemsRemoved(0, count);
52 } 52 }
53 53
54 // Removes an item at given |index| from the model and deletes it. 54 // Removes an item at given |index| from the model and deletes it.
55 void DeleteAt(size_t index) { 55 void DeleteAt(size_t index) {
56 delete RemoveAt(index); 56 delete RemoveAt(index);
57 } 57 }
58 58
59 // Removes and deletes all items from the model. 59 // Removes and deletes all items from the model.
60 void DeleteAll() { 60 void DeleteAll() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 private: 102 private:
103 ScopedVector<ItemType> items_; 103 ScopedVector<ItemType> items_;
104 ObserverList<ListModelObserver> observers_; 104 ObserverList<ListModelObserver> observers_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(ListModel<ItemType>); 106 DISALLOW_COPY_AND_ASSIGN(ListModel<ItemType>);
107 }; 107 };
108 108
109 } // namespace ui 109 } // namespace ui
110 110
111 #endif // UI_BASE_MODELS_LIST_MODEL_H_ 111 #endif // UI_BASE_MODELS_LIST_MODEL_H_
OLDNEW
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.cc ('k') | ui/base/models/tree_node_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698