Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 153403002: IDL compiler: Finish headers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleanup Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp pValue)); 233 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp pValue));
234 } 234 }
235 235
236 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info) 236 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info)
237 { 237 {
238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
239 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info); 239 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info);
240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
241 } 241 }
242 242
243 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info)
244 {
245 TestInterface* imp = V8TestInterface::toNative(info.Holder());
246 v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAt tribute(imp), imp);
247 }
248
249 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
250 {
251 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
252 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGe tter(info);
253 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
254 }
255
256 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
257 {
258 TestInterface* imp = V8TestInterface::toNative(info.Holder());
259 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0);
260 TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr (cppValue));
261 }
262
263 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8:: Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo< void>& info)
264 {
265 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
266 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeSe tter(jsValue, info);
267 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
268 }
269
243 #if ENABLE(CONDITION_PARTIAL) 270 #if ENABLE(CONDITION_PARTIAL)
244 static void supplementalStaticReadOnlyAttrAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info) 271 static void supplementalStaticReadOnlyAttrAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info)
245 { 272 {
246 v8SetReturnValueInt(info, TestPartialInterface::supplementalStaticReadOnlyAt tr()); 273 v8SetReturnValueInt(info, TestPartialInterface::supplementalStaticReadOnlyAt tr());
247 } 274 }
248 #endif // ENABLE(CONDITION_PARTIAL) 275 #endif // ENABLE(CONDITION_PARTIAL)
249 276
250 #if ENABLE(CONDITION_PARTIAL) 277 #if ENABLE(CONDITION_PARTIAL)
251 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info) 278 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info)
252 { 279 {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 802 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
776 return handleScope.Escape(templ); 803 return handleScope.Escape(templ);
777 } 804 }
778 805
779 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate) 806 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate)
780 { 807 {
781 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 808 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
782 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 809 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
783 } 810 }
784 811
812 void V8TestInterface::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, TestInterface* impl, v8::Isolate* isolate)
813 {
814 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype());
815 if (ContextFeatures::implementsContextNameEnabled(impl->document())) {
816 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
817 {"implementsPerContextEnabledNodeAttribute", TestInterfaceV8Internal::im plementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceV8In ternal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */};
818 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
819 }
820 }
821
785 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapp er) 822 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapp er)
786 { 823 {
787 return toNative(wrapper); 824 return toNative(wrapper);
788 } 825 }
789 826
790 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 827 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
791 { 828 {
792 ASSERT(impl); 829 ASSERT(impl);
793 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface>(impl.get(), isolate)) ; 830 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface>(impl.get(), isolate)) ;
794 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 831 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
(...skipping 18 matching lines...) Expand all
813 } 850 }
814 851
815 template<> 852 template<>
816 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 853 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
817 { 854 {
818 return toV8(impl, creationContext, isolate); 855 return toV8(impl, creationContext, isolate);
819 } 856 }
820 857
821 } // namespace WebCore 858 } // namespace WebCore
822 #endif // ENABLE(Condition1) || ENABLE(Condition2) 859 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698