| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 vector_.erase(index); | 109 vector_.erase(index); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SpaceSplitString::Add(const AtomicString& string) { | 112 void SpaceSplitString::Add(const AtomicString& string) { |
| 113 // FIXME: add() does not allow duplicates but createVector() does. | 113 // FIXME: add() does not allow duplicates but createVector() does. |
| 114 if (Contains(string)) | 114 if (Contains(string)) |
| 115 return; | 115 return; |
| 116 EnsureUnique(); | 116 EnsureUnique(); |
| 117 if (data_) | 117 if (data_) |
| 118 data_->Add(string); | 118 data_->Add(string); |
| 119 else |
| 120 data_ = Data::Create(string); |
| 119 } | 121 } |
| 120 | 122 |
| 121 bool SpaceSplitString::Remove(const AtomicString& string) { | 123 bool SpaceSplitString::Remove(const AtomicString& string) { |
| 122 if (!data_) | 124 if (!data_) |
| 123 return false; | 125 return false; |
| 124 unsigned i = 0; | 126 unsigned i = 0; |
| 125 bool changed = false; | 127 bool changed = false; |
| 126 while (i < data_->size()) { | 128 while (i < data_->size()) { |
| 127 if ((*data_)[i] == string) { | 129 if ((*data_)[i] == string) { |
| 128 if (!changed) | 130 if (!changed) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 CreateVector(string); | 185 CreateVector(string); |
| 184 } | 186 } |
| 185 | 187 |
| 186 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) | 188 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) |
| 187 : RefCounted<Data>(), vector_(other.vector_) { | 189 : RefCounted<Data>(), vector_(other.vector_) { |
| 188 // Note that we don't copy m_keyString to indicate to the destructor that | 190 // Note that we don't copy m_keyString to indicate to the destructor that |
| 189 // there's nothing to be removed from the sharedDataMap(). | 191 // there's nothing to be removed from the sharedDataMap(). |
| 190 } | 192 } |
| 191 | 193 |
| 192 } // namespace blink | 194 } // namespace blink |
| OLD | NEW |