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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestPermissiveDictionary.cpp

Issue 2751263002: [Bindings] Cache handles for dictionary keys on V8PerIsolateData. (Closed)
Patch Set: findOrCreateEternalNameCache Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. 5 // This file has been auto-generated by code_generator_v8.py.
6 // DO NOT MODIFY! 6 // DO NOT MODIFY!
7 7
8 // This file has been generated from the Jinja2 template in 8 // This file has been generated from the Jinja2 template in
9 // third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp.tmpl 9 // third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp.tmpl
10 10
11 // clang-format off 11 // clang-format off
12 #include "V8TestPermissiveDictionary.h" 12 #include "V8TestPermissiveDictionary.h"
13 13
14 #include "bindings/core/v8/ExceptionState.h" 14 #include "bindings/core/v8/ExceptionState.h"
15 #include "bindings/core/v8/IDLTypes.h" 15 #include "bindings/core/v8/IDLTypes.h"
16 #include "bindings/core/v8/NativeValueTraitsImpl.h" 16 #include "bindings/core/v8/NativeValueTraitsImpl.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 static const v8::Eternal<v8::Name>* eternalV8TestPermissiveDictionaryKeys(v8::Is olate* isolate) {
21 static const char* const kKeys[] = {
22 "booleanMember",
23 };
24 return V8PerIsolateData::from(isolate)->findOrCreateEternalNameCache(
25 kKeys, kKeys, WTF_ARRAY_LENGTH(kKeys));
26 }
27
20 void V8TestPermissiveDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Valu e> v8Value, TestPermissiveDictionary& impl, ExceptionState& exceptionState) { 28 void V8TestPermissiveDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Valu e> v8Value, TestPermissiveDictionary& impl, ExceptionState& exceptionState) {
21 if (isUndefinedOrNull(v8Value)) { 29 if (isUndefinedOrNull(v8Value)) {
22 return; 30 return;
23 } 31 }
24 if (!v8Value->IsObject()) { 32 if (!v8Value->IsObject()) {
25 // Do nothing. 33 // Do nothing.
26 return; 34 return;
27 } 35 }
28 v8::Local<v8::Object> v8Object = v8Value.As<v8::Object>(); 36 v8::Local<v8::Object> v8Object = v8Value.As<v8::Object>();
29 ALLOW_UNUSED_LOCAL(v8Object); 37 ALLOW_UNUSED_LOCAL(v8Object);
30 38
39 const v8::Eternal<v8::Name>* keys = eternalV8TestPermissiveDictionaryKeys(isol ate);
31 v8::TryCatch block(isolate); 40 v8::TryCatch block(isolate);
41 v8::Local<v8::Context> context = isolate->GetCurrentContext();
32 v8::Local<v8::Value> booleanMemberValue; 42 v8::Local<v8::Value> booleanMemberValue;
33 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "bool eanMember")).ToLocal(&booleanMemberValue)) { 43 if (!v8Object->Get(context, keys[0].Get(isolate)).ToLocal(&booleanMemberValue) ) {
34 exceptionState.rethrowV8Exception(block.Exception()); 44 exceptionState.rethrowV8Exception(block.Exception());
35 return; 45 return;
36 } 46 }
37 if (booleanMemberValue.IsEmpty() || booleanMemberValue->IsUndefined()) { 47 if (booleanMemberValue.IsEmpty() || booleanMemberValue->IsUndefined()) {
38 // Do nothing. 48 // Do nothing.
39 } else { 49 } else {
40 bool booleanMember = NativeValueTraits<IDLBoolean>::nativeValue(isolate, boo leanMemberValue, exceptionState); 50 bool booleanMember = NativeValueTraits<IDLBoolean>::nativeValue(isolate, boo leanMemberValue, exceptionState);
41 if (exceptionState.hadException()) 51 if (exceptionState.hadException())
42 return; 52 return;
43 impl.setBooleanMember(booleanMember); 53 impl.setBooleanMember(booleanMember);
44 } 54 }
45 } 55 }
46 56
47 v8::Local<v8::Value> TestPermissiveDictionary::toV8Impl(v8::Local<v8::Object> cr eationContext, v8::Isolate* isolate) const { 57 v8::Local<v8::Value> TestPermissiveDictionary::toV8Impl(v8::Local<v8::Object> cr eationContext, v8::Isolate* isolate) const {
48 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); 58 v8::Local<v8::Object> v8Object = v8::Object::New(isolate);
49 if (!toV8TestPermissiveDictionary(*this, v8Object, creationContext, isolate)) 59 if (!toV8TestPermissiveDictionary(*this, v8Object, creationContext, isolate))
50 return v8::Undefined(isolate); 60 return v8::Undefined(isolate);
51 return v8Object; 61 return v8Object;
52 } 62 }
53 63
54 bool toV8TestPermissiveDictionary(const TestPermissiveDictionary& impl, v8::Loca l<v8::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* is olate) { 64 bool toV8TestPermissiveDictionary(const TestPermissiveDictionary& impl, v8::Loca l<v8::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* is olate) {
65 const v8::Eternal<v8::Name>* keys = eternalV8TestPermissiveDictionaryKeys(isol ate);
66 v8::Local<v8::Context> context = isolate->GetCurrentContext();
55 v8::Local<v8::Value> booleanMemberValue; 67 v8::Local<v8::Value> booleanMemberValue;
56 bool booleanMemberHasValueOrDefault = false; 68 bool booleanMemberHasValueOrDefault = false;
57 if (impl.hasBooleanMember()) { 69 if (impl.hasBooleanMember()) {
58 booleanMemberValue = v8Boolean(impl.booleanMember(), isolate); 70 booleanMemberValue = v8Boolean(impl.booleanMember(), isolate);
59 booleanMemberHasValueOrDefault = true; 71 booleanMemberHasValueOrDefault = true;
60 } 72 }
61 if (booleanMemberHasValueOrDefault && 73 if (booleanMemberHasValueOrDefault &&
62 !v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext() , v8AtomicString(isolate, "booleanMember"), booleanMemberValue))) { 74 !v8CallBoolean(dictionary->CreateDataProperty(context, keys[0].Get(isolate ), booleanMemberValue))) {
63 return false; 75 return false;
64 } 76 }
65 77
66 return true; 78 return true;
67 } 79 }
68 80
69 TestPermissiveDictionary NativeValueTraits<TestPermissiveDictionary>::nativeValu e(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionSta te) { 81 TestPermissiveDictionary NativeValueTraits<TestPermissiveDictionary>::nativeValu e(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionSta te) {
70 TestPermissiveDictionary impl; 82 TestPermissiveDictionary impl;
71 V8TestPermissiveDictionary::toImpl(isolate, value, impl, exceptionState); 83 V8TestPermissiveDictionary::toImpl(isolate, value, impl, exceptionState);
72 return impl; 84 return impl;
73 } 85 }
74 86
75 } // namespace blink 87 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698