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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 TestInterfacePython2* impl = fromInternalPointer(object); | 83 TestInterfacePython2* impl = fromInternalPointer(object); |
84 // The ownerNode() method may return a reference or a pointer. | 84 // The ownerNode() method may return a reference or a pointer. |
85 if (Node* owner = WTF::getPtr(impl->ownerNode())) { | 85 if (Node* owner = WTF::getPtr(impl->ownerNode())) { |
86 Node* root = V8GCController::opaqueRootForGC(owner, isolate); | 86 Node* root = V8GCController::opaqueRootForGC(owner, isolate); |
87 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r
oot)), wrapper); | 87 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r
oot)), wrapper); |
88 return; | 88 return; |
89 } | 89 } |
90 setObjectGroup(object, wrapper, isolate); | 90 setObjectGroup(object, wrapper, isolate); |
91 } | 91 } |
92 | 92 |
93 static void configureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 93 static void configureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate) |
94 { | 94 { |
95 functionTemplate->ReadOnlyPrototype(); | 95 functionTemplate->ReadOnlyPrototype(); |
96 | 96 |
97 v8::Local<v8::Signature> defaultSignature; | 97 v8::Local<v8::Signature> defaultSignature; |
98 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython2::internalFieldCount, | 98 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython2::internalFieldCount, |
99 0, 0, | 99 0, 0, |
100 0, 0, | 100 0, 0, |
101 0, 0, | 101 0, 0, |
102 isolate, currentWorldType); | 102 isolate); |
103 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 103 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
104 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 104 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
105 | 105 |
106 // Custom toString template | 106 // Custom toString template |
107 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 107 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
108 } | 108 } |
109 | 109 |
110 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 110 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate
* isolate) |
111 { | 111 { |
112 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 112 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
113 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 113 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
114 if (result != data->templateMap(currentWorldType).end()) | 114 if (result != data->templateMap().end()) |
115 return result->value.newLocal(isolate); | 115 return result->value.newLocal(isolate); |
116 | 116 |
117 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 117 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
118 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 118 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
119 configureV8TestInterfacePython2Template(templ, isolate, currentWorldType); | 119 configureV8TestInterfacePython2Template(templ, isolate); |
120 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 120 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
121 return templ; | 121 return templ; |
122 } | 122 } |
123 | 123 |
124 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 124 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
125 { | 125 { |
126 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 126 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
127 } | 127 } |
128 | 128 |
129 v8::Handle<v8::Object> V8TestInterfacePython2::findInstanceInPrototypeChain(v8::
Handle<v8::Value> jsValue, v8::Isolate* isolate) | 129 v8::Handle<v8::Object> V8TestInterfacePython2::findInstanceInPrototypeChain(v8::
Handle<v8::Value> jsValue, v8::Isolate* isolate) |
130 { | 130 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 fromInternalPointer(object)->deref(); | 172 fromInternalPointer(object)->deref(); |
173 } | 173 } |
174 | 174 |
175 template<> | 175 template<> |
176 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 176 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
177 { | 177 { |
178 return toV8(impl, creationContext, isolate); | 178 return toV8(impl, creationContext, isolate); |
179 } | 179 } |
180 | 180 |
181 } // namespace WebCore | 181 } // namespace WebCore |
OLD | NEW |