OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 namespace WebCore { | 68 namespace WebCore { |
69 const WrapperTypeInfo V8TestInterfaceDoNotCheckConstants::wrapperTypeInfo = { gi
n::kEmbedderBlink, V8TestInterfaceDoNotCheckConstants::domTemplate, V8TestInterf
aceDoNotCheckConstants::derefObject, 0, 0, 0, V8TestInterfaceDoNotCheckConstants
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | 69 const WrapperTypeInfo V8TestInterfaceDoNotCheckConstants::wrapperTypeInfo = { gi
n::kEmbedderBlink, V8TestInterfaceDoNotCheckConstants::domTemplate, V8TestInterf
aceDoNotCheckConstants::derefObject, 0, 0, 0, V8TestInterfaceDoNotCheckConstants
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; |
70 | 70 |
71 namespace TestInterfaceDoNotCheckConstantsV8Internal { | 71 namespace TestInterfaceDoNotCheckConstantsV8Internal { |
72 | 72 |
73 template <typename T> void V8_USE(T) { } | 73 template <typename T> void V8_USE(T) { } |
74 | 74 |
75 } // namespace TestInterfaceDoNotCheckConstantsV8Internal | 75 } // namespace TestInterfaceDoNotCheckConstantsV8Internal |
76 | 76 |
77 static void configureV8TestInterfaceDoNotCheckConstantsTemplate(v8::Handle<v8::F
unctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType curren
tWorldType) | 77 static void configureV8TestInterfaceDoNotCheckConstantsTemplate(v8::Handle<v8::F
unctionTemplate> functionTemplate, v8::Isolate* isolate) |
78 { | 78 { |
79 functionTemplate->ReadOnlyPrototype(); | 79 functionTemplate->ReadOnlyPrototype(); |
80 | 80 |
81 v8::Local<v8::Signature> defaultSignature; | 81 v8::Local<v8::Signature> defaultSignature; |
82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceDoNotCheckConstants", v8::Local<v8::FunctionTemplate>(), V8Te
stInterfaceDoNotCheckConstants::internalFieldCount, | 82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceDoNotCheckConstants", v8::Local<v8::FunctionTemplate>(), V8Te
stInterfaceDoNotCheckConstants::internalFieldCount, |
83 0, 0, | 83 0, 0, |
84 0, 0, | 84 0, 0, |
85 0, 0, | 85 0, 0, |
86 isolate, currentWorldType); | 86 isolate); |
87 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 87 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
88 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 88 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
89 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceDoNotC
heckConstantsConstants[] = { | 89 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceDoNotC
heckConstantsConstants[] = { |
90 {"CONST_VALUE_0", 0}, | 90 {"CONST_VALUE_0", 0}, |
91 {"CONST_JAVASCRIPT", 1}, | 91 {"CONST_JAVASCRIPT", 1}, |
92 }; | 92 }; |
93 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestInterfaceDoNotCheckConstantsConstants, WTF_ARRAY_LENGTH(V8TestInterfaceDoNot
CheckConstantsConstants), isolate); | 93 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestInterfaceDoNotCheckConstantsConstants, WTF_ARRAY_LENGTH(V8TestInterfaceDoNot
CheckConstantsConstants), isolate); |
94 | 94 |
95 // Custom toString template | 95 // Custom toString template |
96 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 96 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
97 } | 97 } |
98 | 98 |
99 v8::Handle<v8::FunctionTemplate> V8TestInterfaceDoNotCheckConstants::domTemplate
(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 99 v8::Handle<v8::FunctionTemplate> V8TestInterfaceDoNotCheckConstants::domTemplate
(v8::Isolate* isolate) |
100 { | 100 { |
101 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 101 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
102 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 102 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
103 if (result != data->templateMap(currentWorldType).end()) | 103 if (result != data->templateMap().end()) |
104 return result->value.newLocal(isolate); | 104 return result->value.newLocal(isolate); |
105 | 105 |
106 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 106 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
107 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 107 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
108 configureV8TestInterfaceDoNotCheckConstantsTemplate(templ, isolate, currentW
orldType); | 108 configureV8TestInterfaceDoNotCheckConstantsTemplate(templ, isolate); |
109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 109 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
110 return templ; | 110 return templ; |
111 } | 111 } |
112 | 112 |
113 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate) | 113 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate) |
114 { | 114 { |
115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
116 } | 116 } |
117 | 117 |
118 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::findInstanceInPrototy
peChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 118 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::findInstanceInPrototy
peChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
119 { | 119 { |
(...skipping 30 matching lines...) Expand all Loading... |
150 fromInternalPointer(object)->deref(); | 150 fromInternalPointer(object)->deref(); |
151 } | 151 } |
152 | 152 |
153 template<> | 153 template<> |
154 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) | 154 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) |
155 { | 155 { |
156 return toV8(impl, creationContext, isolate); | 156 return toV8(impl, creationContext, isolate); |
157 } | 157 } |
158 | 158 |
159 } // namespace WebCore | 159 } // namespace WebCore |
OLD | NEW |