| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) | 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) |
| 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 break; | 97 break; |
| 98 } | 98 } |
| 99 if (j == thisSize) | 99 if (j == thisSize) |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 return true; | 102 return true; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SpaceSplitString::Data::add(const AtomicString& string) | 105 void SpaceSplitString::Data::add(const AtomicString& string) |
| 106 { | 106 { |
| 107 ASSERT(hasOneRef()); | 107 DCHECK(hasOneRef()); |
| 108 ASSERT(!contains(string)); | 108 DCHECK(!contains(string)); |
| 109 m_vector.append(string); | 109 m_vector.append(string); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SpaceSplitString::Data::remove(unsigned index) | 112 void SpaceSplitString::Data::remove(unsigned index) |
| 113 { | 113 { |
| 114 ASSERT(hasOneRef()); | 114 DCHECK(hasOneRef()); |
| 115 m_vector.remove(index); | 115 m_vector.remove(index); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void SpaceSplitString::add(const AtomicString& string) | 118 void SpaceSplitString::add(const AtomicString& string) |
| 119 { | 119 { |
| 120 // FIXME: add() does not allow duplicates but createVector() does. | 120 // FIXME: add() does not allow duplicates but createVector() does. |
| 121 if (contains(string)) | 121 if (contains(string)) |
| 122 return; | 122 return; |
| 123 ensureUnique(); | 123 ensureUnique(); |
| 124 if (m_data) | 124 if (m_data) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique(const Da
ta& other) | 185 PassRefPtr<SpaceSplitString::Data> SpaceSplitString::Data::createUnique(const Da
ta& other) |
| 186 { | 186 { |
| 187 return adoptRef(new SpaceSplitString::Data(other)); | 187 return adoptRef(new SpaceSplitString::Data(other)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 SpaceSplitString::Data::Data(const AtomicString& string) | 190 SpaceSplitString::Data::Data(const AtomicString& string) |
| 191 : m_keyString(string) | 191 : m_keyString(string) |
| 192 { | 192 { |
| 193 ASSERT(!string.isNull()); | 193 DCHECK(!string.isNull()); |
| 194 createVector(string); | 194 createVector(string); |
| 195 } | 195 } |
| 196 | 196 |
| 197 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) | 197 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) |
| 198 : RefCounted<Data>() | 198 : RefCounted<Data>() |
| 199 , m_vector(other.m_vector) | 199 , m_vector(other.m_vector) |
| 200 { | 200 { |
| 201 // Note that we don't copy m_keyString to indicate to the destructor that th
ere's nothing | 201 // Note that we don't copy m_keyString to indicate to the destructor that th
ere's nothing |
| 202 // to be removed from the sharedDataMap(). | 202 // to be removed from the sharedDataMap(). |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |