| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | 120 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); |
| 121 instanceTemplate->SetInternalFieldCount(V8TestInterfaceNamedConstructor2::in
ternalFieldCount); | 121 instanceTemplate->SetInternalFieldCount(V8TestInterfaceNamedConstructor2::in
ternalFieldCount); |
| 122 result->SetClassName(v8::String::NewFromUtf8(isolate, "TestInterfaceNamedCon
structor2", v8::String::kInternalizedString)); | 122 result->SetClassName(v8::String::NewFromUtf8(isolate, "TestInterfaceNamedCon
structor2", v8::String::kInternalizedString)); |
| 123 result->Inherit(V8TestInterfaceNamedConstructor2::domTemplate(isolate, curre
ntWorldType)); | 123 result->Inherit(V8TestInterfaceNamedConstructor2::domTemplate(isolate, curre
ntWorldType)); |
| 124 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); | 124 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); |
| 125 | 125 |
| 126 return scope.Escape(result); | 126 return scope.Escape(result); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceNamedConstructor
2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | 129 static void configureV8TestInterfaceNamedConstructor2Template(v8::Handle<v8::Fun
ctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentW
orldType) |
| 130 { | 130 { |
| 131 functionTemplate->ReadOnlyPrototype(); | 131 functionTemplate->ReadOnlyPrototype(); |
| 132 | 132 |
| 133 v8::Local<v8::Signature> defaultSignature; | 133 v8::Local<v8::Signature> defaultSignature; |
| 134 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNamedConstructor2", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceNamedConstructor2::internalFieldCount, | 134 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNamedConstructor2", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceNamedConstructor2::internalFieldCount, |
| 135 0, 0, | 135 0, 0, |
| 136 0, 0, | 136 0, 0, |
| 137 0, 0, | 137 0, 0, |
| 138 isolate, currentWorldType); | 138 isolate, currentWorldType); |
| 139 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 139 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 140 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 140 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 141 | 141 |
| 142 // Custom toString template | 142 // Custom toString template |
| 143 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 143 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 144 return functionTemplate; | |
| 145 } | 144 } |
| 146 | 145 |
| 147 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2::domTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) | 146 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2::domTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 148 { | 147 { |
| 149 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 148 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 150 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 149 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 151 if (result != data->templateMap(currentWorldType).end()) | 150 if (result != data->templateMap(currentWorldType).end()) |
| 152 return result->value.newLocal(isolate); | 151 return result->value.newLocal(isolate); |
| 153 | 152 |
| 154 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 153 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 155 v8::EscapableHandleScope handleScope(isolate); | 154 v8::EscapableHandleScope handleScope(isolate); |
| 156 v8::Local<v8::FunctionTemplate> templ = | 155 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 157 ConfigureV8TestInterfaceNamedConstructor2Template(data->rawDOMTemplate(&
wrapperTypeInfo, currentWorldType), isolate, currentWorldType); | 156 configureV8TestInterfaceNamedConstructor2Template(templ, isolate, currentWor
ldType); |
| 158 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 157 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 159 return handleScope.Escape(templ); | 158 return handleScope.Escape(templ); |
| 160 } | 159 } |
| 161 | 160 |
| 162 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 161 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 163 { | 162 { |
| 164 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 163 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 165 } | 164 } |
| 166 | 165 |
| 167 bool V8TestInterfaceNamedConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Valu
e> jsValue, v8::Isolate* isolate) | 166 bool V8TestInterfaceNamedConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Valu
e> jsValue, v8::Isolate* isolate) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 196 fromInternalPointer(object)->deref(); | 195 fromInternalPointer(object)->deref(); |
| 197 } | 196 } |
| 198 | 197 |
| 199 template<> | 198 template<> |
| 200 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 199 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 201 { | 200 { |
| 202 return toV8(impl, creationContext, isolate); | 201 return toV8(impl, creationContext, isolate); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace WebCore | 204 } // namespace WebCore |
| OLD | NEW |