| 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 V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject,
0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | 69 const WrapperTypeInfo V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject,
0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; |
| 70 | 70 |
| 71 namespace TestInterfacePython3V8Internal { | 71 namespace TestInterfacePython3V8Internal { |
| 72 | 72 |
| 73 template <typename T> void V8_USE(T) { } | 73 template <typename T> void V8_USE(T) { } |
| 74 | 74 |
| 75 } // namespace TestInterfacePython3V8Internal | 75 } // namespace TestInterfacePython3V8Internal |
| 76 | 76 |
| 77 static void configureV8TestInterfacePython3Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 77 static void configureV8TestInterfacePython3Template(v8::Handle<v8::FunctionTempl
ate> 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, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython3::internalFieldCount, | 82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython3::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 | 89 |
| 90 // Custom toString template | 90 // Custom toString template |
| 91 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 91 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 94 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate
* isolate) |
| 95 { | 95 { |
| 96 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 96 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 97 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 97 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 98 if (result != data->templateMap(currentWorldType).end()) | 98 if (result != data->templateMap().end()) |
| 99 return result->value.newLocal(isolate); | 99 return result->value.newLocal(isolate); |
| 100 | 100 |
| 101 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 101 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 102 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 102 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 103 configureV8TestInterfacePython3Template(templ, isolate, currentWorldType); | 103 configureV8TestInterfacePython3Template(templ, isolate); |
| 104 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 104 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 105 return templ; | 105 return templ; |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 108 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
| 109 { | 109 { |
| 110 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 110 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 111 } | 111 } |
| 112 | 112 |
| 113 v8::Handle<v8::Object> V8TestInterfacePython3::findInstanceInPrototypeChain(v8::
Handle<v8::Value> jsValue, v8::Isolate* isolate) | 113 v8::Handle<v8::Object> V8TestInterfacePython3::findInstanceInPrototypeChain(v8::
Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 114 { | 114 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 145 fromInternalPointer(object)->deref(); | 145 fromInternalPointer(object)->deref(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 template<> | 148 template<> |
| 149 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 149 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 150 { | 150 { |
| 151 return toV8(impl, creationContext, isolate); | 151 return toV8(impl, creationContext, isolate); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace WebCore | 154 } // namespace WebCore |
| OLD | NEW |