OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 if (m_atomicString.isNull()) { | 112 if (m_atomicString.isNull()) { |
113 m_atomicString = AtomicString(m_plainString); | 113 m_atomicString = AtomicString(m_plainString); |
114 ASSERT(!m_atomicString.isNull()); | 114 ASSERT(!m_atomicString.isNull()); |
115 if (m_plainString.impl() != m_atomicString.impl()) | 115 if (m_plainString.impl() != m_atomicString.impl()) |
116 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory
(memoryConsumption(m_atomicString.string())); | 116 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory
(memoryConsumption(m_atomicString.string())); |
117 } | 117 } |
118 return m_atomicString; | 118 return m_atomicString; |
119 } | 119 } |
120 | 120 |
121 const CompressibleString& compressibleString() { return m_compressibleString
; } | 121 const CompressibleString& getCompressibleString() { return m_compressibleStr
ing; } |
122 | 122 |
123 protected: | 123 protected: |
124 // A shallow copy of the string. Keeps the string buffer alive until the V8
engine garbage collects it. | 124 // A shallow copy of the string. Keeps the string buffer alive until the V8
engine garbage collects it. |
125 String m_plainString; | 125 String m_plainString; |
126 // If this string is atomic or has been made atomic earlier the | 126 // If this string is atomic or has been made atomic earlier the |
127 // atomic string is held here. In the case where the string starts | 127 // atomic string is held here. In the case where the string starts |
128 // off non-atomic and becomes atomic later it is necessary to keep | 128 // off non-atomic and becomes atomic later it is necessary to keep |
129 // the original string alive because v8 may keep derived pointers | 129 // the original string alive because v8 may keep derived pointers |
130 // into that string. | 130 // into that string. |
131 AtomicString m_atomicString; | 131 AtomicString m_atomicString; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 403 } |
404 | 404 |
405 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const | 405 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const |
406 { | 406 { |
407 return String(); | 407 return String(); |
408 } | 408 } |
409 | 409 |
410 } // namespace blink | 410 } // namespace blink |
411 | 411 |
412 #endif // V8StringResource_h | 412 #endif // V8StringResource_h |
OLD | NEW |