| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 152 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 153 v8SetReturnValue(info, info.Holder()); | 153 v8SetReturnValue(info, info.Holder()); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 | 156 |
| 157 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info); | 157 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info); |
| 158 } | 158 } |
| 159 | 159 |
| 160 static void configureV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8
::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cur
rentWorldType) | 160 static void configureV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8
::FunctionTemplate> functionTemplate, v8::Isolate* isolate) |
| 161 { | 161 { |
| 162 functionTemplate->ReadOnlyPrototype(); | 162 functionTemplate->ReadOnlyPrototype(); |
| 163 | 163 |
| 164 v8::Local<v8::Signature> defaultSignature; | 164 v8::Local<v8::Signature> defaultSignature; |
| 165 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate,
currentWorldType), V8TestInterfaceWillBeGarbageCollected::internalFieldCount, | 165 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate),
V8TestInterfaceWillBeGarbageCollected::internalFieldCount, |
| 166 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test
InterfaceWillBeGarbageCollectedAttributes), | 166 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test
InterfaceWillBeGarbageCollectedAttributes), |
| 167 0, 0, | 167 0, 0, |
| 168 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt
erfaceWillBeGarbageCollectedMethods), | 168 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt
erfaceWillBeGarbageCollectedMethods), |
| 169 isolate, currentWorldType); | 169 isolate); |
| 170 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons
tructorCallback); | 170 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons
tructorCallback); |
| 171 functionTemplate->SetLength(1); | 171 functionTemplate->SetLength(1); |
| 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 173 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 173 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 174 | 174 |
| 175 // Custom toString template | 175 // Custom toString template |
| 176 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 176 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 v8::Handle<v8::FunctionTemplate> V8TestInterfaceWillBeGarbageCollected::domTempl
ate(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 179 v8::Handle<v8::FunctionTemplate> V8TestInterfaceWillBeGarbageCollected::domTempl
ate(v8::Isolate* isolate) |
| 180 { | 180 { |
| 181 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 181 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 182 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 182 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 183 if (result != data->templateMap(currentWorldType).end()) | 183 if (result != data->templateMap().end()) |
| 184 return result->value.newLocal(isolate); | 184 return result->value.newLocal(isolate); |
| 185 | 185 |
| 186 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 186 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 187 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 187 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 188 configureV8TestInterfaceWillBeGarbageCollectedTemplate(templ, isolate, curre
ntWorldType); | 188 configureV8TestInterfaceWillBeGarbageCollectedTemplate(templ, isolate); |
| 189 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 189 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 190 return templ; | 190 return templ; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> js
Value, v8::Isolate* isolate) | 193 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> js
Value, v8::Isolate* isolate) |
| 194 { | 194 { |
| 195 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 195 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 196 } | 196 } |
| 197 | 197 |
| 198 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::findInstanceInProt
otypeChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 198 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::findInstanceInProt
otypeChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 199 { | 199 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 #endif // !ENABLE(OILPAN) | 237 #endif // !ENABLE(OILPAN) |
| 238 } | 238 } |
| 239 | 239 |
| 240 template<> | 240 template<> |
| 241 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 241 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 242 { | 242 { |
| 243 return toV8(impl, creationContext, isolate); | 243 return toV8(impl, creationContext, isolate); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace WebCore | 246 } // namespace WebCore |
| OLD | NEW |