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

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataObject.cpp

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 DataObjectItem* DataObject::item(unsigned long index) { 81 DataObjectItem* DataObject::item(unsigned long index) {
82 if (index >= length()) 82 if (index >= length())
83 return nullptr; 83 return nullptr;
84 return m_itemList[index]; 84 return m_itemList[index];
85 } 85 }
86 86
87 void DataObject::deleteItem(unsigned long index) { 87 void DataObject::deleteItem(unsigned long index) {
88 if (index >= length()) 88 if (index >= length())
89 return; 89 return;
90 m_itemList.remove(index); 90 m_itemList.erase(index);
91 } 91 }
92 92
93 void DataObject::clearAll() { 93 void DataObject::clearAll() {
94 m_itemList.clear(); 94 m_itemList.clear();
95 } 95 }
96 96
97 DataObjectItem* DataObject::add(const String& data, const String& type) { 97 DataObjectItem* DataObject::add(const String& data, const String& type) {
98 DataObjectItem* item = DataObjectItem::createFromString(type, data); 98 DataObjectItem* item = DataObjectItem::createFromString(type, data);
99 if (!internalAddStringItem(item)) 99 if (!internalAddStringItem(item))
100 return nullptr; 100 return nullptr;
(...skipping 17 matching lines...) Expand all
118 DataObjectItem::createFromFileWithFileSystemId(file, fileSystemId); 118 DataObjectItem::createFromFileWithFileSystemId(file, fileSystemId);
119 internalAddFileItem(item); 119 internalAddFileItem(item);
120 return item; 120 return item;
121 } 121 }
122 122
123 void DataObject::clearData(const String& type) { 123 void DataObject::clearData(const String& type) {
124 for (size_t i = 0; i < m_itemList.size(); ++i) { 124 for (size_t i = 0; i < m_itemList.size(); ++i) {
125 if (m_itemList[i]->kind() == DataObjectItem::StringKind && 125 if (m_itemList[i]->kind() == DataObjectItem::StringKind &&
126 m_itemList[i]->type() == type) { 126 m_itemList[i]->type() == type) {
127 // Per the spec, type must be unique among all items of kind 'string'. 127 // Per the spec, type must be unique among all items of kind 'string'.
128 m_itemList.remove(i); 128 m_itemList.erase(i);
129 return; 129 return;
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 Vector<String> DataObject::types() const { 134 Vector<String> DataObject::types() const {
135 Vector<String> results; 135 Vector<String> results;
136 #if DCHECK_IS_ON() 136 #if DCHECK_IS_ON()
137 HashSet<String> typesSeen; 137 HashSet<String> typesSeen;
138 #endif 138 #endif
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } else { 362 } else {
363 ASSERT_NOT_REACHED(); 363 ASSERT_NOT_REACHED();
364 } 364 }
365 itemList[i] = item; 365 itemList[i] = item;
366 } 366 }
367 data.swapItems(itemList); 367 data.swapItems(itemList);
368 return data; 368 return data;
369 } 369 }
370 370
371 } // namespace blink 371 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698