Index: Source/bindings/v8/V8Binding.h |
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h |
index 27eed7615d691af6c4a57748a589cea5189696a2..9c7849148921e8289faa9fdd11608cbbcbd93e96 100644 |
--- a/Source/bindings/v8/V8Binding.h |
+++ b/Source/bindings/v8/V8Binding.h |
@@ -163,6 +163,33 @@ namespace WebCore { |
V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString(info.GetReturnValue(), string.impl()); |
} |
+ // Convert v8::String to a WTF::String. If the V8 string is not already |
+ // an external string then it is transformed into an external string at this |
+ // point to avoid repeated conversions. |
+ inline String toWebCoreString(v8::Handle<v8::String> value) |
+ { |
+ return v8StringToWebCoreString<String>(value, Externalize); |
+ } |
+ |
+ inline String toWebCoreStringWithNullCheck(v8::Handle<v8::String> value) |
+ { |
+ if (value.IsEmpty() || value->IsNull()) |
+ return String(); |
+ return toWebCoreString(value); |
+ } |
+ |
+ inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> value) |
+ { |
+ if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) |
+ return String(); |
+ return toWebCoreString(value); |
+ } |
+ |
+ inline AtomicString toWebCoreAtomicString(v8::Handle<v8::String> value) |
+ { |
+ return v8StringToWebCoreString<AtomicString>(value, Externalize); |
+ } |
+ |
// Convert v8 types to a WTF::String. If the V8 string is not already |
// an external string then it is transformed into an external string at this |
// point to avoid repeated conversions. |
@@ -205,15 +232,6 @@ namespace WebCore { |
return stringResource; |
} |
- // FIXME: See the above comment. |
- inline AtomicString toWebCoreAtomicStringWithNullCheck(v8::Handle<v8::Value> value) |
- { |
- V8StringResource<WithNullCheck> stringResource(value); |
- if (!stringResource.prepare()) |
- return AtomicString(); |
- return stringResource; |
- } |
- |
// 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 |