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