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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 static void testInterfacePythonAttributeAttributeGetter(const v8::PropertyCallba
ckInfo<v8::Value>& info) | 76 static void testInterfacePythonAttributeAttributeGetter(const v8::PropertyCallba
ckInfo<v8::Value>& info) |
77 { | 77 { |
78 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 78 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
79 v8SetReturnValueFast(info, imp->testInterfacePythonAttribute(), imp); | 79 v8SetReturnValueFast(info, imp->testInterfacePythonAttribute(), imp); |
80 } | 80 } |
81 | 81 |
82 static void testInterfacePythonAttributeAttributeGetterCallback(v8::Local<v8::St
ring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 82 static void testInterfacePythonAttributeAttributeGetterCallback(v8::Local<v8::St
ring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
83 { | 83 { |
84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
85 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeGetter(info); | 85 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeGetter(info); |
86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
87 } | 87 } |
88 | 88 |
89 static void testInterfacePythonAttributeAttributeSetter(v8::Local<v8::Value> jsV
alue, const v8::PropertyCallbackInfo<void>& info) | 89 static void testInterfacePythonAttributeAttributeSetter(v8::Local<v8::Value> jsV
alue, const v8::PropertyCallbackInfo<void>& info) |
90 { | 90 { |
91 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 91 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
92 V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfac
ePython::hasInstance(jsValue, info.GetIsolate(), worldType(info.GetIsolate())) ?
V8TestInterfacePython::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); | 92 V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfac
ePython::hasInstance(jsValue, info.GetIsolate(), worldType(info.GetIsolate())) ?
V8TestInterfacePython::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
93 imp->setTestInterfacePythonAttribute(WTF::getPtr(cppValue)); | 93 imp->setTestInterfacePythonAttribute(WTF::getPtr(cppValue)); |
94 } | 94 } |
95 | 95 |
96 static void testInterfacePythonAttributeAttributeSetterCallback(v8::Local<v8::St
ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 96 static void testInterfacePythonAttributeAttributeSetterCallback(v8::Local<v8::St
ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
97 { | 97 { |
98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
99 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeSetter(jsValue, info); | 99 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeSetter(jsValue, info); |
100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
101 } | 101 } |
102 | 102 |
103 static void perWorldBindingsStringAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) | 103 static void perWorldBindingsStringAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) |
104 { | 104 { |
105 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 105 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
106 v8SetReturnValueString(info, imp->perWorldBindingsStringAttribute(), info.Ge
tIsolate()); | 106 v8SetReturnValueString(info, imp->perWorldBindingsStringAttribute(), info.Ge
tIsolate()); |
107 } | 107 } |
108 | 108 |
109 static void perWorldBindingsStringAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 109 static void perWorldBindingsStringAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
110 { | 110 { |
111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
112 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeGetter(info); | 112 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeGetter(info); |
113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
114 } | 114 } |
115 | 115 |
116 static void perWorldBindingsStringAttributeAttributeSetter(v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) | 116 static void perWorldBindingsStringAttributeAttributeSetter(v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) |
117 { | 117 { |
118 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 118 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
119 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 119 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
120 imp->setPerWorldBindingsStringAttribute(cppValue); | 120 imp->setPerWorldBindingsStringAttribute(cppValue); |
121 } | 121 } |
122 | 122 |
123 static void perWorldBindingsStringAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& in
fo) | 123 static void perWorldBindingsStringAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& in
fo) |
124 { | 124 { |
125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
126 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeSetter(jsValue, info); | 126 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeSetter(jsValue, info); |
127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
128 } | 128 } |
129 | 129 |
130 static void perWorldBindingsStringAttributeAttributeGetterForMainWorld(const v8:
:PropertyCallbackInfo<v8::Value>& info) | 130 static void perWorldBindingsStringAttributeAttributeGetterForMainWorld(const v8:
:PropertyCallbackInfo<v8::Value>& info) |
131 { | 131 { |
132 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 132 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
133 v8SetReturnValueString(info, imp->perWorldBindingsStringAttribute(), info.Ge
tIsolate()); | 133 v8SetReturnValueString(info, imp->perWorldBindingsStringAttribute(), info.Ge
tIsolate()); |
134 } | 134 } |
135 | 135 |
136 static void perWorldBindingsStringAttributeAttributeGetterCallbackForMainWorld(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 136 static void perWorldBindingsStringAttributeAttributeGetterCallbackForMainWorld(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
137 { | 137 { |
138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
139 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeGetterForMainWorld(info); | 139 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeGetterForMainWorld(info); |
140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
141 } | 141 } |
142 | 142 |
143 static void perWorldBindingsStringAttributeAttributeSetterForMainWorld(v8::Local
<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 143 static void perWorldBindingsStringAttributeAttributeSetterForMainWorld(v8::Local
<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
144 { | 144 { |
145 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 145 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
146 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 146 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
147 imp->setPerWorldBindingsStringAttribute(cppValue); | 147 imp->setPerWorldBindingsStringAttribute(cppValue); |
148 } | 148 } |
149 | 149 |
150 static void perWorldBindingsStringAttributeAttributeSetterCallbackForMainWorld(v
8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn
fo<void>& info) | 150 static void perWorldBindingsStringAttributeAttributeSetterCallbackForMainWorld(v
8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn
fo<void>& info) |
151 { | 151 { |
152 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 152 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
153 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeSetterForMainWorld(jsValue, info); | 153 TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttribute
AttributeSetterForMainWorld(jsValue, info); |
154 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 154 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
155 } | 155 } |
156 | 156 |
157 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 157 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
158 { | 158 { |
159 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 159 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
160 imp->voidMethod(); | 160 imp->voidMethod(); |
161 } | 161 } |
162 | 162 |
163 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 163 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
164 { | 164 { |
165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
166 TestInterfacePythonImplementationV8Internal::voidMethodMethod(info); | 166 TestInterfacePythonImplementationV8Internal::voidMethodMethod(info); |
167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
168 } | 168 } |
169 | 169 |
170 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 170 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Valu
e>& info) |
171 { | 171 { |
172 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 172 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
173 imp->voidMethod(); | 173 imp->voidMethod(); |
174 } | 174 } |
175 | 175 |
176 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<
v8::Value>& info) | 176 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<
v8::Value>& info) |
177 { | 177 { |
178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
179 TestInterfacePythonImplementationV8Internal::voidMethodMethodForMainWorld(in
fo); | 179 TestInterfacePythonImplementationV8Internal::voidMethodMethodForMainWorld(in
fo); |
180 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 180 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
181 } | 181 } |
182 | 182 |
183 } // namespace TestInterfacePythonImplementationV8Internal | 183 } // namespace TestInterfacePythonImplementationV8Internal |
184 | 184 |
185 void V8TestInterfacePython::visitDOMWrapper(void* object, const v8::Persistent<v
8::Object>& wrapper, v8::Isolate* isolate) | 185 void V8TestInterfacePython::visitDOMWrapper(void* object, const v8::Persistent<v
8::Object>& wrapper, v8::Isolate* isolate) |
186 { | 186 { |
187 TestInterfacePythonImplementation* impl = fromInternalPointer(object); | 187 TestInterfacePythonImplementation* impl = fromInternalPointer(object); |
188 v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate,
wrapper); | 188 v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate,
wrapper); |
189 V8WrapperInstantiationScope scope(creationContext, isolate); | 189 V8WrapperInstantiationScope scope(creationContext, isolate); |
190 ReferencedType* referencedName = impl->referencedName(); | 190 ReferencedType* referencedName = impl->referencedName(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 template<> | 266 template<> |
267 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 267 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) |
268 { | 268 { |
269 return toV8(impl, creationContext, isolate); | 269 return toV8(impl, creationContext, isolate); |
270 } | 270 } |
271 | 271 |
272 } // namespace WebCore | 272 } // namespace WebCore |
273 #endif // ENABLE(CONDITION) | 273 #endif // ENABLE(CONDITION) |
OLD | NEW |