| Index: third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp
|
| index 571f400aed419b717c9ef6fa39b60f33d737cb34..b4f32143ad6e103537806800cfbc908b746ebdfc 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp
|
| @@ -12,39 +12,51 @@ V8ObjectBuilder::V8ObjectBuilder(ScriptState* scriptState)
|
| : m_scriptState(scriptState),
|
| m_object(v8::Object::New(scriptState->isolate())) {}
|
|
|
| -V8ObjectBuilder& V8ObjectBuilder::add(const String& name,
|
| +V8ObjectBuilder& V8ObjectBuilder::add(const StringView& name,
|
| const V8ObjectBuilder& value) {
|
| addInternal(name, value.v8Value());
|
| return *this;
|
| }
|
|
|
| -V8ObjectBuilder& V8ObjectBuilder::addNull(const String& name) {
|
| +V8ObjectBuilder& V8ObjectBuilder::addNull(const StringView& name) {
|
| addInternal(name, v8::Null(m_scriptState->isolate()));
|
| return *this;
|
| }
|
|
|
| -V8ObjectBuilder& V8ObjectBuilder::addBoolean(const String& name, bool value) {
|
| +V8ObjectBuilder& V8ObjectBuilder::addBoolean(const StringView& name,
|
| + bool value) {
|
| addInternal(name, value ? v8::True(m_scriptState->isolate())
|
| : v8::False(m_scriptState->isolate()));
|
| return *this;
|
| }
|
|
|
| -V8ObjectBuilder& V8ObjectBuilder::addNumber(const String& name, double value) {
|
| +V8ObjectBuilder& V8ObjectBuilder::addNumber(const StringView& name,
|
| + double value) {
|
| addInternal(name, v8::Number::New(m_scriptState->isolate(), value));
|
| return *this;
|
| }
|
|
|
| -V8ObjectBuilder& V8ObjectBuilder::addString(const String& name,
|
| - const String& value) {
|
| +V8ObjectBuilder& V8ObjectBuilder::addString(const StringView& name,
|
| + const StringView& value) {
|
| addInternal(name, v8String(m_scriptState->isolate(), value));
|
| return *this;
|
| }
|
|
|
| +V8ObjectBuilder& V8ObjectBuilder::addStringOrNull(const StringView& name,
|
| + const StringView& value) {
|
| + if (value.isNull()) {
|
| + addInternal(name, v8::Null(m_scriptState->isolate()));
|
| + } else {
|
| + addInternal(name, v8String(m_scriptState->isolate(), value));
|
| + }
|
| + return *this;
|
| +}
|
| +
|
| ScriptValue V8ObjectBuilder::scriptValue() const {
|
| return ScriptValue(m_scriptState.get(), m_object);
|
| }
|
|
|
| -void V8ObjectBuilder::addInternal(const String& name,
|
| +void V8ObjectBuilder::addInternal(const StringView& name,
|
| v8::Local<v8::Value> value) {
|
| if (m_object.IsEmpty())
|
| return;
|
|
|