OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 UseCounter::DOMStringList_Contains_Method_IndexedDB); | 62 UseCounter::DOMStringList_Contains_Method_IndexedDB); |
63 break; | 63 break; |
64 case DOMStringList::Location: | 64 case DOMStringList::Location: |
65 UseCounter::count(context, | 65 UseCounter::count(context, |
66 UseCounter::DOMStringList_Contains_Method_Location); | 66 UseCounter::DOMStringList_Contains_Method_Location); |
67 break; | 67 break; |
68 default: | 68 default: |
69 ASSERT_NOT_REACHED(); | 69 ASSERT_NOT_REACHED(); |
70 } | 70 } |
71 | 71 |
72 // FIXME: Currently, all consumers of DOMStringList store fairly small lists a
nd thus an O(n) | 72 // FIXME: Currently, all consumers of DOMStringList store fairly small lists |
73 // algorithm is OK. But this may need to be optimized if larger amount
s of data are | 73 // and thus an O(n) algorithm is OK. But this may need to be optimized if |
74 // stored in m_strings. | 74 // larger amounts of data are stored in m_strings. |
75 size_t count = m_strings.size(); | 75 size_t count = m_strings.size(); |
76 for (size_t i = 0; i < count; ++i) { | 76 for (size_t i = 0; i < count; ++i) { |
77 if (m_strings[i] == string) | 77 if (m_strings[i] == string) |
78 return true; | 78 return true; |
79 } | 79 } |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 void DOMStringList::sort() { | 83 void DOMStringList::sort() { |
84 std::sort(m_strings.begin(), m_strings.end(), WTF::codePointCompareLessThan); | 84 std::sort(m_strings.begin(), m_strings.end(), WTF::codePointCompareLessThan); |
85 } | 85 } |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
OLD | NEW |