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 "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/V8Binding.h" | 39 #include "bindings/v8/V8Binding.h" |
40 #include "bindings/v8/V8DOMConfiguration.h" | 40 #include "bindings/v8/V8DOMConfiguration.h" |
41 #include "bindings/v8/V8DOMWrapper.h" | 41 #include "bindings/v8/V8DOMWrapper.h" |
42 #include "core/dom/ContextFeatures.h" | 42 #include "core/dom/ContextFeatures.h" |
43 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
44 #include "platform/TraceEvent.h" | 44 #include "platform/TraceEvent.h" |
45 #include "wtf/GetPtr.h" | 45 #include "wtf/GetPtr.h" |
46 #include "wtf/RefPtr.h" | 46 #include "wtf/RefPtr.h" |
47 #include "wtf/UnusedParam.h" | |
48 | 47 |
49 namespace WebCore { | 48 namespace WebCore { |
50 | 49 |
51 static void initializeScriptWrappableForInterface(RealClass* object) | 50 static void initializeScriptWrappableForInterface(RealClass* object) |
52 { | 51 { |
53 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 52 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
54 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceImplemented
As::wrapperTypeInfo); | 53 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceImplemented
As::wrapperTypeInfo); |
55 else | 54 else |
56 ASSERT_NOT_REACHED(); | 55 ASSERT_NOT_REACHED(); |
57 } | 56 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceImplementedAsTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 177 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceImplementedAsTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
179 { | 178 { |
180 functionTemplate->ReadOnlyPrototype(); | 179 functionTemplate->ReadOnlyPrototype(); |
181 | 180 |
182 v8::Local<v8::Signature> defaultSignature; | 181 v8::Local<v8::Signature> defaultSignature; |
183 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceImplementedAs", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceImplementedAs::internalFieldCount, | 182 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceImplementedAs", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceImplementedAs::internalFieldCount, |
184 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), | 183 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), |
185 0, 0, | 184 0, 0, |
186 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), | 185 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), |
187 isolate, currentWorldType); | 186 isolate, currentWorldType); |
188 UNUSED_PARAM(defaultSignature); | 187 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
189 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 188 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
190 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | |
191 UNUSED_PARAM(instanceTemplate); | |
192 UNUSED_PARAM(prototypeTemplate); | |
193 | 189 |
194 // Custom Signature 'funcTestInterfaceImplementedAsParam' | 190 // Custom Signature 'funcTestInterfaceImplementedAsParam' |
195 const int funcTestInterfaceImplementedAsParamArgc = 1; | 191 const int funcTestInterfaceImplementedAsParamArgc = 1; |
196 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; | 192 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; |
197 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(isolate, functionTemplate, funcTestInterfaceImplementedAsParamAr
gc, funcTestInterfaceImplementedAsParamArgv); | 193 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(isolate, functionTemplate, funcTestInterfaceImplementedAsParamAr
gc, funcTestInterfaceImplementedAsParamArgv); |
198 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "funcTestInterfaceIm
plementedAsParam", v8::String::kInternalizedString), v8::FunctionTemplate::New(i
solate, RealClassV8Internal::funcTestInterfaceImplementedAsParamMethodCallback,
v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); | 194 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "funcTestInterfaceIm
plementedAsParam", v8::String::kInternalizedString), v8::FunctionTemplate::New(i
solate, RealClassV8Internal::funcTestInterfaceImplementedAsParamMethodCallback,
v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); |
199 | 195 |
200 // Custom toString template | 196 // Custom toString template |
201 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 197 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
202 return functionTemplate; | 198 return functionTemplate; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 fromInternalPointer(object)->deref(); | 250 fromInternalPointer(object)->deref(); |
255 } | 251 } |
256 | 252 |
257 template<> | 253 template<> |
258 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | 254 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) |
259 { | 255 { |
260 return toV8(impl, creationContext, isolate); | 256 return toV8(impl, creationContext, isolate); |
261 } | 257 } |
262 | 258 |
263 } // namespace WebCore | 259 } // namespace WebCore |
OLD | NEW |