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