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 23 matching lines...) Expand all Loading... |
34 #include "V8TestNode.h" | 34 #include "V8TestNode.h" |
35 | 35 |
36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
37 #include "bindings/v8/ExceptionMessages.h" | 37 #include "bindings/v8/ExceptionMessages.h" |
38 #include "bindings/v8/ExceptionState.h" | 38 #include "bindings/v8/ExceptionState.h" |
39 #include "bindings/v8/V8DOMConfiguration.h" | 39 #include "bindings/v8/V8DOMConfiguration.h" |
40 #include "bindings/v8/V8ObjectConstructor.h" | 40 #include "bindings/v8/V8ObjectConstructor.h" |
41 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
44 #include "wtf/UnusedParam.h" | |
45 | 44 |
46 namespace WebCore { | 45 namespace WebCore { |
47 | 46 |
48 static void initializeScriptWrappableForInterface(TestNode* object) | 47 static void initializeScriptWrappableForInterface(TestNode* object) |
49 { | 48 { |
50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 49 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
51 ScriptWrappable::setTypeInfoInObject(object, &V8TestNode::wrapperTypeInf
o); | 50 ScriptWrappable::setTypeInfoInObject(object, &V8TestNode::wrapperTypeInf
o); |
52 else | 51 else |
53 ASSERT_NOT_REACHED(); | 52 ASSERT_NOT_REACHED(); |
54 } | 53 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestNodeTemplate(v8::Handle<v
8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cu
rrentWorldType) | 161 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestNodeTemplate(v8::Handle<v
8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cu
rrentWorldType) |
163 { | 162 { |
164 functionTemplate->ReadOnlyPrototype(); | 163 functionTemplate->ReadOnlyPrototype(); |
165 | 164 |
166 v8::Local<v8::Signature> defaultSignature; | 165 v8::Local<v8::Signature> defaultSignature; |
167 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestNode", V8Node::domTemplate(isolate, currentWorldType), V8TestNode::int
ernalFieldCount, | 166 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestNode", V8Node::domTemplate(isolate, currentWorldType), V8TestNode::int
ernalFieldCount, |
168 V8TestNodeAttributes, WTF_ARRAY_LENGTH(V8TestNodeAttributes), | 167 V8TestNodeAttributes, WTF_ARRAY_LENGTH(V8TestNodeAttributes), |
169 0, 0, | 168 0, 0, |
170 0, 0, | 169 0, 0, |
171 isolate, currentWorldType); | 170 isolate, currentWorldType); |
172 UNUSED_PARAM(defaultSignature); | |
173 functionTemplate->SetCallHandler(V8TestNode::constructorCallback); | 171 functionTemplate->SetCallHandler(V8TestNode::constructorCallback); |
174 functionTemplate->SetLength(0); | 172 functionTemplate->SetLength(0); |
175 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 173 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
176 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 174 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
177 UNUSED_PARAM(instanceTemplate); | |
178 UNUSED_PARAM(prototypeTemplate); | |
179 | 175 |
180 // Custom toString template | 176 // Custom toString template |
181 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 177 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
182 return functionTemplate; | 178 return functionTemplate; |
183 } | 179 } |
184 | 180 |
185 v8::Handle<v8::FunctionTemplate> V8TestNode::domTemplate(v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 181 v8::Handle<v8::FunctionTemplate> V8TestNode::domTemplate(v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
186 { | 182 { |
187 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 183 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
188 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 184 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 fromInternalPointer(object)->deref(); | 235 fromInternalPointer(object)->deref(); |
240 } | 236 } |
241 | 237 |
242 template<> | 238 template<> |
243 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) | 239 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) |
244 { | 240 { |
245 return toV8(impl, creationContext, isolate); | 241 return toV8(impl, creationContext, isolate); |
246 } | 242 } |
247 | 243 |
248 } // namespace WebCore | 244 } // namespace WebCore |
OLD | NEW |