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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 99 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
100 v8SetReturnValue(info, info.Holder()); | 100 v8SetReturnValue(info, info.Holder()); |
101 return; | 101 return; |
102 } | 102 } |
103 | 103 |
104 TestInterfaceConstructor3V8Internal::constructor(info); | 104 TestInterfaceConstructor3V8Internal::constructor(info); |
105 } | 105 } |
106 | 106 |
107 static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::Function
Template> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldT
ype) | 107 static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::Function
Template> functionTemplate, v8::Isolate* isolate) |
108 { | 108 { |
109 functionTemplate->ReadOnlyPrototype(); | 109 functionTemplate->ReadOnlyPrototype(); |
110 | 110 |
111 v8::Local<v8::Signature> defaultSignature; | 111 v8::Local<v8::Signature> defaultSignature; |
112 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor3::internalFieldCount, | 112 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor3::internalFieldCount, |
113 0, 0, | 113 0, 0, |
114 0, 0, | 114 0, 0, |
115 0, 0, | 115 0, 0, |
116 isolate, currentWorldType); | 116 isolate); |
117 functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCal
lback); | 117 functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCal
lback); |
118 functionTemplate->SetLength(1); | 118 functionTemplate->SetLength(1); |
119 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 119 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
120 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 120 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
121 | 121 |
122 // Custom toString template | 122 // Custom toString template |
123 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 123 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
124 } | 124 } |
125 | 125 |
126 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Is
olate* isolate, WrapperWorldType currentWorldType) | 126 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Is
olate* isolate) |
127 { | 127 { |
128 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 128 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
129 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 129 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
130 if (result != data->templateMap(currentWorldType).end()) | 130 if (result != data->templateMap().end()) |
131 return result->value.newLocal(isolate); | 131 return result->value.newLocal(isolate); |
132 | 132 |
133 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 133 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
134 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 134 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
135 configureV8TestInterfaceConstructor3Template(templ, isolate, currentWorldTyp
e); | 135 configureV8TestInterfaceConstructor3Template(templ, isolate); |
136 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 136 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
137 return templ; | 137 return templ; |
138 } | 138 } |
139 | 139 |
140 bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) | 140 bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) |
141 { | 141 { |
142 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 142 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
143 } | 143 } |
144 | 144 |
145 v8::Handle<v8::Object> V8TestInterfaceConstructor3::findInstanceInPrototypeChain
(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 145 v8::Handle<v8::Object> V8TestInterfaceConstructor3::findInstanceInPrototypeChain
(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
146 { | 146 { |
(...skipping 30 matching lines...) Expand all Loading... |
177 fromInternalPointer(object)->deref(); | 177 fromInternalPointer(object)->deref(); |
178 } | 178 } |
179 | 179 |
180 template<> | 180 template<> |
181 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) | 181 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) |
182 { | 182 { |
183 return toV8(impl, creationContext, isolate); | 183 return toV8(impl, creationContext, isolate); |
184 } | 184 } |
185 | 185 |
186 } // namespace WebCore | 186 } // namespace WebCore |
OLD | NEW |