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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
32 | 32 |
33 #include "config.h" | 33 #include "config.h" |
34 #include "V8TestInterfacePython3.h" | 34 #include "V8TestInterfaceAudioBuffer.h" |
35 | 35 |
36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
38 #include "bindings/v8/V8DOMConfiguration.h" | 38 #include "bindings/v8/V8DOMConfiguration.h" |
39 #include "bindings/v8/V8ObjectConstructor.h" | 39 #include "bindings/v8/V8ObjectConstructor.h" |
40 #include "core/dom/ContextFeatures.h" | 40 #include "core/dom/ContextFeatures.h" |
41 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 42 #include "modules/webaudio/AudioBuffer.h" |
42 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
43 | 44 |
44 namespace WebCore { | 45 namespace WebCore { |
45 | 46 |
46 static void initializeScriptWrappableForInterface(TestInterfacePython3* object) | 47 static void initializeScriptWrappableForInterface(TestInterfaceAudioBuffer* obje
ct) |
47 { | 48 { |
48 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 49 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
49 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython3::wr
apperTypeInfo); | 50 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceAudioBuffer
::wrapperTypeInfo); |
50 else | 51 else |
51 ASSERT_NOT_REACHED(); | 52 ASSERT_NOT_REACHED(); |
52 } | 53 } |
53 | 54 |
54 } // namespace WebCore | 55 } // namespace WebCore |
55 | 56 |
56 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 57 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
57 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 58 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
58 // in the global namespace. | 59 // in the global namespace. |
59 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 60 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
60 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython3*
object) | 61 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceAudioBuf
fer* object) |
61 { | 62 { |
62 WebCore::initializeScriptWrappableForInterface(object); | 63 WebCore::initializeScriptWrappableForInterface(object); |
63 } | 64 } |
64 | 65 |
65 namespace WebCore { | 66 namespace WebCore { |
66 const WrapperTypeInfo V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject,
0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | 67 const WrapperTypeInfo V8TestInterfaceAudioBuffer::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestInterfaceAudioBuffer::domTemplate, V8TestInterfaceAudioBuffer::
derefObject, 0, 0, 0, V8TestInterfaceAudioBuffer::installPerContextEnabledMethod
s, &V8AudioBuffer::wrapperTypeInfo, WrapperTypeObjectPrototype }; |
67 | 68 |
68 namespace TestInterfacePython3V8Internal { | 69 namespace TestInterfaceAudioBufferV8Internal { |
69 | 70 |
70 template <typename T> void V8_USE(T) { } | 71 template <typename T> void V8_USE(T) { } |
71 | 72 |
72 } // namespace TestInterfacePython3V8Internal | 73 } // namespace TestInterfaceAudioBufferV8Internal |
73 | 74 |
74 static void configureV8TestInterfacePython3Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 75 static void configureV8TestInterfaceAudioBufferTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldTy
pe) |
75 { | 76 { |
76 functionTemplate->ReadOnlyPrototype(); | 77 functionTemplate->ReadOnlyPrototype(); |
77 | 78 |
78 v8::Local<v8::Signature> defaultSignature; | 79 v8::Local<v8::Signature> defaultSignature; |
79 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython3::internalFieldCount, | 80 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceAudioBuffer", V8AudioBuffer::domTemplate(isolate, currentWorl
dType), V8TestInterfaceAudioBuffer::internalFieldCount, |
80 0, 0, | 81 0, 0, |
81 0, 0, | 82 0, 0, |
82 0, 0, | 83 0, 0, |
83 isolate, currentWorldType); | 84 isolate, currentWorldType); |
84 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 85 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
85 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 86 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
86 | 87 |
87 // Custom toString template | 88 // Custom toString template |
88 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 89 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
89 } | 90 } |
90 | 91 |
91 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 92 v8::Handle<v8::FunctionTemplate> V8TestInterfaceAudioBuffer::domTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) |
92 { | 93 { |
93 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 94 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
94 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 95 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
95 if (result != data->templateMap(currentWorldType).end()) | 96 if (result != data->templateMap(currentWorldType).end()) |
96 return result->value.newLocal(isolate); | 97 return result->value.newLocal(isolate); |
97 | 98 |
98 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 99 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
99 v8::EscapableHandleScope handleScope(isolate); | 100 v8::EscapableHandleScope handleScope(isolate); |
100 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 101 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
101 configureV8TestInterfacePython3Template(templ, isolate, currentWorldType); | 102 configureV8TestInterfaceAudioBufferTemplate(templ, isolate, currentWorldType
); |
102 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 103 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
103 return handleScope.Escape(templ); | 104 return handleScope.Escape(templ); |
104 } | 105 } |
105 | 106 |
106 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) | 107 bool V8TestInterfaceAudioBuffer::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate, WrapperWorldType currentWorldType) |
107 { | 108 { |
108 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 109 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
109 } | 110 } |
110 | 111 |
111 bool V8TestInterfacePython3::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 112 bool V8TestInterfaceAudioBuffer::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate) |
112 { | 113 { |
113 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
114 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 115 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
115 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 116 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
116 } | 117 } |
117 | 118 |
118 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte
rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | 119 v8::Handle<v8::Object> V8TestInterfaceAudioBuffer::createWrapper(PassRefPtr<Test
InterfaceAudioBuffer> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) |
119 { | 120 { |
120 ASSERT(impl); | 121 ASSERT(impl); |
121 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is
olate)); | 122 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceAudioBuffer>(impl.get()
, isolate)); |
122 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 123 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
123 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 124 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
124 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 125 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
125 // the same object de-ref functions, though, so use that as the basis of
the check. | 126 // the same object de-ref functions, though, so use that as the basis of
the check. |
126 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 127 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
127 } | 128 } |
128 | 129 |
129 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 130 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
130 if (UNLIKELY(wrapper.IsEmpty())) | 131 if (UNLIKELY(wrapper.IsEmpty())) |
131 return wrapper; | 132 return wrapper; |
132 | 133 |
| 134 for (unsigned i = 0, n = impl->numberOfChannels(); i < n; i++) { |
| 135 Float32Array* channelData = impl->getChannelData(i); |
| 136 channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocation
Observer::instanceTemplate()); |
| 137 } |
133 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 138 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
134 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython3>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | 139 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceAudioBuffer>(impl, &
wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
135 return wrapper; | 140 return wrapper; |
136 } | 141 } |
137 | 142 |
138 void V8TestInterfacePython3::derefObject(void* object) | 143 void V8TestInterfaceAudioBuffer::derefObject(void* object) |
139 { | 144 { |
140 fromInternalPointer(object)->deref(); | 145 fromInternalPointer(object)->deref(); |
141 } | 146 } |
142 | 147 |
143 template<> | 148 template<> |
144 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 149 v8::Handle<v8::Value> toV8NoInline(TestInterfaceAudioBuffer* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
145 { | 150 { |
146 return toV8(impl, creationContext, isolate); | 151 return toV8(impl, creationContext, isolate); |
147 } | 152 } |
148 | 153 |
149 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |