| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 unsigned length() const { return m_length; } | 152 unsigned length() const { return m_length; } |
| 153 bool isEmpty() const { return !m_length; } | 153 bool isEmpty() const { return !m_length; } |
| 154 | 154 |
| 155 unsigned capacity() const; | 155 unsigned capacity() const; |
| 156 void reserveCapacity(unsigned newCapacity); | 156 void reserveCapacity(unsigned newCapacity); |
| 157 | 157 |
| 158 // TODO(esprehn): Rename to shrink(). | 158 // TODO(esprehn): Rename to shrink(). |
| 159 void resize(unsigned newSize); | 159 void resize(unsigned newSize); |
| 160 | 160 |
| 161 UChar operator[](unsigned i) const { | 161 UChar operator[](unsigned i) const { |
| 162 ASSERT_WITH_SECURITY_IMPLICATION(i < m_length); | 162 SECURITY_DCHECK(i < m_length); |
| 163 if (m_is8Bit) | 163 if (m_is8Bit) |
| 164 return characters8()[i]; | 164 return characters8()[i]; |
| 165 return characters16()[i]; | 165 return characters16()[i]; |
| 166 } | 166 } |
| 167 | 167 |
| 168 const LChar* characters8() const { | 168 const LChar* characters8() const { |
| 169 DCHECK(m_is8Bit); | 169 DCHECK(m_is8Bit); |
| 170 if (!length()) | 170 if (!length()) |
| 171 return nullptr; | 171 return nullptr; |
| 172 if (!m_string.isNull()) | 172 if (!m_string.isNull()) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 inline bool operator!=(const String& a, const StringBuilder& b) { | 308 inline bool operator!=(const String& a, const StringBuilder& b) { |
| 309 return !equal(b, a); | 309 return !equal(b, a); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace WTF | 312 } // namespace WTF |
| 313 | 313 |
| 314 using WTF::StringBuilder; | 314 using WTF::StringBuilder; |
| 315 | 315 |
| 316 #endif // StringBuilder_h | 316 #endif // StringBuilder_h |
| OLD | NEW |