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

Side by Side Diff: third_party/WebKit/Source/core/dom/SpaceSplitString.h

Issue 2553343002: Avoid WTF::Vector::at() and operator[] in core/dom. (Closed)
Patch Set: Created 4 years 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) 2007, 2008, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 private: 61 private:
62 class Data : public RefCounted<Data> { 62 class Data : public RefCounted<Data> {
63 public: 63 public:
64 static PassRefPtr<Data> create(const AtomicString&); 64 static PassRefPtr<Data> create(const AtomicString&);
65 static PassRefPtr<Data> createUnique(const Data&); 65 static PassRefPtr<Data> createUnique(const Data&);
66 66
67 ~Data(); 67 ~Data();
68 68
69 bool contains(const AtomicString& string) { 69 bool contains(const AtomicString& string) {
70 size_t size = m_vector.size(); 70 for (const auto& item : m_vector) {
71 for (size_t i = 0; i < size; ++i) { 71 if (item == string)
72 if (m_vector[i] == string)
73 return true; 72 return true;
74 } 73 }
75 return false; 74 return false;
76 } 75 }
77 76
78 bool containsAll(Data&); 77 bool containsAll(Data&);
79 78
80 void add(const AtomicString&); 79 void add(const AtomicString&);
81 void remove(unsigned index); 80 void remove(unsigned index);
82 81
(...skipping 20 matching lines...) Expand all
103 if (m_data && !m_data->isUnique()) 102 if (m_data && !m_data->isUnique())
104 m_data = Data::createUnique(*m_data); 103 m_data = Data::createUnique(*m_data);
105 } 104 }
106 105
107 RefPtr<Data> m_data; 106 RefPtr<Data> m_data;
108 }; 107 };
109 108
110 } // namespace blink 109 } // namespace blink
111 110
112 #endif // SpaceSplitString_h 111 #endif // SpaceSplitString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698