| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 WebCoreStringResource16* stringResource = new WebCoreStringResource16(string
); | 69 WebCoreStringResource16* stringResource = new WebCoreStringResource16(string
); |
| 70 v8::Local<v8::String> newString; | 70 v8::Local<v8::String> newString; |
| 71 if (!v8::String::NewExternalTwoByte(isolate, stringResource).ToLocal(&newStr
ing)) { | 71 if (!v8::String::NewExternalTwoByte(isolate, stringResource).ToLocal(&newStr
ing)) { |
| 72 delete stringResource; | 72 delete stringResource; |
| 73 return v8::String::Empty(isolate); | 73 return v8::String::Empty(isolate); |
| 74 } | 74 } |
| 75 return newString; | 75 return newString; |
| 76 } | 76 } |
| 77 | 77 |
| 78 v8::Handle<v8::String> StringCache::v8ExternalStringSlow(v8::Isolate* isolate, S
tringImpl* stringImpl) | 78 v8::Local<v8::String> StringCache::v8ExternalStringSlow(v8::Isolate* isolate, St
ringImpl* stringImpl) |
| 79 { | 79 { |
| 80 if (!stringImpl->length()) | 80 if (!stringImpl->length()) |
| 81 return v8::String::Empty(isolate); | 81 return v8::String::Empty(isolate); |
| 82 | 82 |
| 83 StringCacheMapTraits::MapType::PersistentValueReference cachedV8String = m_s
tringCache.GetReference(stringImpl); | 83 StringCacheMapTraits::MapType::PersistentValueReference cachedV8String = m_s
tringCache.GetReference(stringImpl); |
| 84 if (!cachedV8String.IsEmpty()) { | 84 if (!cachedV8String.IsEmpty()) { |
| 85 m_lastStringImpl = stringImpl; | 85 m_lastStringImpl = stringImpl; |
| 86 m_lastV8String = cachedV8String; | 86 m_lastV8String = cachedV8String; |
| 87 return m_lastV8String.NewLocal(isolate); | 87 return m_lastV8String.NewLocal(isolate); |
| 88 } | 88 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return newString; | 127 return newString; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void StringCache::InvalidateLastString() | 130 void StringCache::InvalidateLastString() |
| 131 { | 131 { |
| 132 m_lastStringImpl = nullptr; | 132 m_lastStringImpl = nullptr; |
| 133 m_lastV8String.Reset(); | 133 m_lastV8String.Reset(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |