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 24 matching lines...) Expand all Loading... |
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/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
39 #include "bindings/v8/V8DOMConfiguration.h" | 39 #include "bindings/v8/V8DOMConfiguration.h" |
40 #include "bindings/v8/V8DOMWrapper.h" | 40 #include "bindings/v8/V8DOMWrapper.h" |
41 #include "bindings/v8/V8ObjectConstructor.h" | 41 #include "bindings/v8/V8ObjectConstructor.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/UnusedParam.h" | |
46 | 45 |
47 namespace WebCore { | 46 namespace WebCore { |
48 | 47 |
49 static void initializeScriptWrappableForInterface(TestInterfaceConstructor* obje
ct) | 48 static void initializeScriptWrappableForInterface(TestInterfaceConstructor* obje
ct) |
50 { | 49 { |
51 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
52 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor
::wrapperTypeInfo); | 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor
::wrapperTypeInfo); |
53 else | 52 else |
54 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
55 } | 54 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTempl
ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra
pperWorldType currentWorldType) | 101 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTempl
ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra
pperWorldType currentWorldType) |
103 { | 102 { |
104 functionTemplate->ReadOnlyPrototype(); | 103 functionTemplate->ReadOnlyPrototype(); |
105 | 104 |
106 v8::Local<v8::Signature> defaultSignature; | 105 v8::Local<v8::Signature> defaultSignature; |
107 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf
aceConstructor::internalFieldCount, | 106 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf
aceConstructor::internalFieldCount, |
108 0, 0, | 107 0, 0, |
109 0, 0, | 108 0, 0, |
110 0, 0, | 109 0, 0, |
111 isolate, currentWorldType); | 110 isolate, currentWorldType); |
112 UNUSED_PARAM(defaultSignature); | |
113 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall
back); | 111 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall
back); |
114 functionTemplate->SetLength(0); | 112 functionTemplate->SetLength(0); |
115 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 113 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
116 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 114 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
117 UNUSED_PARAM(instanceTemplate); | |
118 UNUSED_PARAM(prototypeTemplate); | |
119 | 115 |
120 // Custom toString template | 116 // Custom toString template |
121 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 117 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
122 return functionTemplate; | 118 return functionTemplate; |
123 } | 119 } |
124 | 120 |
125 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::GetTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) | 121 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::GetTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) |
126 { | 122 { |
127 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 123 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
128 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 124 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 fromInternalPointer(object)->deref(); | 170 fromInternalPointer(object)->deref(); |
175 } | 171 } |
176 | 172 |
177 template<> | 173 template<> |
178 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 174 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
179 { | 175 { |
180 return toV8(impl, creationContext, isolate); | 176 return toV8(impl, creationContext, isolate); |
181 } | 177 } |
182 | 178 |
183 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |