Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h |
| index b903b47d4f250286850a375f4398486d782c5edc..3d5ea9e20f91f19ec507c2cf2548f142e2cfce26 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h |
| @@ -397,14 +397,17 @@ inline String toCoreStringWithUndefinedOrNullCheck(v8::Local<v8::Value> value) |
| } |
| // Convert a string to a V8 string. |
| -// Return a V8 external string that shares the underlying buffer with the given |
| -// WebCore string. The reference counting mechanism is used to keep the |
| -// underlying buffer alive while the string is still live in the V8 engine. |
| -inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string) |
| + |
| +inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const StringView& string) |
| { |
| + DCHECK(isolate); |
| if (string.isNull()) |
| return v8::String::Empty(isolate); |
| - return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(isolate, string.impl()); |
| + if (StringImpl* impl = string.sharedImpl()) |
| + return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(isolate, impl); |
| + if (string.is8Bit()) |
| + return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_t*>(string.characters8()), v8::NewStringType::kNormal, static_cast<int>(string.length())).ToLocalChecked(); |
|
haraken
2016/08/27 01:21:46
Don't you want to use:
V8PerIsolateData::from(i
esprehn
2016/08/27 02:18:57
Hmm? There's no such thing as string.impl() on a S
esprehn
2016/08/27 02:24:03
ex.
https://cs.chromium.org/chromium/src/third_p
|
| + return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>(string.characters16()), v8::NewStringType::kNormal, static_cast<int>(string.length())).ToLocalChecked(); |
| } |
| inline v8::Local<v8::Value> v8StringOrNull(v8::Isolate* isolate, const AtomicString& string) |