Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp

Issue 2751263002: [Bindings] Cache handles for dictionary keys on V8PerIsolateData. (Closed)
Patch Set: const Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp
index 7dc20bc729e15957d9f97a2a9020582cff3eccf0..cca2fb79f10e4bec3e02ff1fad4d3d859315f144 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp
@@ -18,6 +18,14 @@
namespace blink {
+static const v8::Eternal<v8::Name>* eternalV8TestInterfaceEventInitKeys(v8::Isolate* isolate) {
+ static const char* const kKeys[] = {
+ "stringMember",
+ };
+ return V8PerIsolateData::from(isolate)->findOrCreateKeys(
+ kKeys, kKeys, WTF_ARRAY_LENGTH(kKeys));
+}
+
void V8TestInterfaceEventInit::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceEventInit& impl, ExceptionState& exceptionState) {
if (isUndefinedOrNull(v8Value)) {
return;
@@ -33,9 +41,11 @@ void V8TestInterfaceEventInit::toImpl(v8::Isolate* isolate, v8::Local<v8::Value>
if (exceptionState.hadException())
return;
+ const v8::Eternal<v8::Name>* keys = eternalV8TestInterfaceEventInitKeys(isolate);
v8::TryCatch block(isolate);
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> stringMemberValue;
- if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "stringMember")).ToLocal(&stringMemberValue)) {
+ if (!v8Object->Get(context, keys[0].Get(isolate)).ToLocal(&stringMemberValue)) {
exceptionState.rethrowV8Exception(block.Exception());
return;
}
@@ -60,8 +70,10 @@ bool toV8TestInterfaceEventInit(const TestInterfaceEventInit& impl, v8::Local<v8
if (!toV8EventInit(impl, dictionary, creationContext, isolate))
return false;
+ const v8::Eternal<v8::Name>* keys = eternalV8TestInterfaceEventInitKeys(isolate);
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (impl.hasStringMember()) {
- if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8AtomicString(isolate, "stringMember"), v8String(isolate, impl.stringMember()))))
+ if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[0].Get(isolate), v8String(isolate, impl.stringMember()))))
return false;
}

Powered by Google App Engine
This is Rietveld 408576698