Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp |
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp |
index 618267ea27f5f78e7b2e5365dfcfb7b30def4c4d..dae468a1b7fccfa98959931cea728ce37d90dd80 100644 |
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp |
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp |
@@ -18,6 +18,17 @@ |
namespace blink { |
+static const v8::Eternal<v8::Name>* eternalV8TestDictionaryDerivedImplementedAsKeys(v8::Isolate* isolate) { |
+ static const char* const kKeys[] = { |
+ "derivedStringMember", |
+ "derivedStringMemberWithDefault", |
+ "requiredLongMember", |
+ "stringOrDoubleSequenceMember", |
+ }; |
+ return V8PerIsolateData::from(isolate)->findOrCreateKeys( |
+ kKeys, kKeys, WTF_ARRAY_LENGTH(kKeys)); |
+} |
+ |
void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState& exceptionState) { |
if (isUndefinedOrNull(v8Value)) { |
exceptionState.throwTypeError("Missing required member(s): requiredLongMember."); |
@@ -34,9 +45,11 @@ void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Loca |
if (exceptionState.hadException()) |
return; |
+ const v8::Eternal<v8::Name>* keys = eternalV8TestDictionaryDerivedImplementedAsKeys(isolate); |
v8::TryCatch block(isolate); |
+ v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
v8::Local<v8::Value> derivedStringMemberValue; |
- if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "derivedStringMember")).ToLocal(&derivedStringMemberValue)) { |
+ if (!v8Object->Get(context, keys[0].Get(isolate)).ToLocal(&derivedStringMemberValue)) { |
exceptionState.rethrowV8Exception(block.Exception()); |
return; |
} |
@@ -50,7 +63,7 @@ void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Loca |
} |
v8::Local<v8::Value> derivedStringMemberWithDefaultValue; |
- if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "derivedStringMemberWithDefault")).ToLocal(&derivedStringMemberWithDefaultValue)) { |
+ if (!v8Object->Get(context, keys[1].Get(isolate)).ToLocal(&derivedStringMemberWithDefaultValue)) { |
exceptionState.rethrowV8Exception(block.Exception()); |
return; |
} |
@@ -64,7 +77,7 @@ void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Loca |
} |
v8::Local<v8::Value> requiredLongMemberValue; |
- if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "requiredLongMember")).ToLocal(&requiredLongMemberValue)) { |
+ if (!v8Object->Get(context, keys[2].Get(isolate)).ToLocal(&requiredLongMemberValue)) { |
exceptionState.rethrowV8Exception(block.Exception()); |
return; |
} |
@@ -79,7 +92,7 @@ void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Loca |
} |
v8::Local<v8::Value> stringOrDoubleSequenceMemberValue; |
- if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "stringOrDoubleSequenceMember")).ToLocal(&stringOrDoubleSequenceMemberValue)) { |
+ if (!v8Object->Get(context, keys[3].Get(isolate)).ToLocal(&stringOrDoubleSequenceMemberValue)) { |
exceptionState.rethrowV8Exception(block.Exception()); |
return; |
} |
@@ -104,28 +117,30 @@ bool toV8TestDictionaryDerivedImplementedAs(const TestDictionaryDerivedImplement |
if (!toV8TestDictionary(impl, dictionary, creationContext, isolate)) |
return false; |
+ const v8::Eternal<v8::Name>* keys = eternalV8TestDictionaryDerivedImplementedAsKeys(isolate); |
+ v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
if (impl.hasDerivedStringMember()) { |
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "derivedStringMember"), v8String(isolate, impl.derivedStringMember())))) |
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[0].Get(isolate), v8String(isolate, impl.derivedStringMember())))) |
return false; |
} |
if (impl.hasDerivedStringMemberWithDefault()) { |
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "derivedStringMemberWithDefault"), v8String(isolate, impl.derivedStringMemberWithDefault())))) |
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[1].Get(isolate), v8String(isolate, impl.derivedStringMemberWithDefault())))) |
return false; |
} else { |
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "derivedStringMemberWithDefault"), v8String(isolate, "default string value")))) |
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[1].Get(isolate), v8String(isolate, "default string value")))) |
return false; |
} |
if (impl.hasRequiredLongMember()) { |
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "requiredLongMember"), v8::Integer::New(isolate, impl.requiredLongMember())))) |
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[2].Get(isolate), v8::Integer::New(isolate, impl.requiredLongMember())))) |
return false; |
} else { |
NOTREACHED(); |
} |
if (impl.hasStringOrDoubleSequenceMember()) { |
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "stringOrDoubleSequenceMember"), ToV8(impl.stringOrDoubleSequenceMember(), creationContext, isolate)))) |
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[3].Get(isolate), ToV8(impl.stringOrDoubleSequenceMember(), creationContext, isolate)))) |
return false; |
} |