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

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

Issue 104873018: Remove raw DOM templates from V8 bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 82 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
83 v8SetReturnValue(info, info.Holder()); 83 v8SetReturnValue(info, info.Holder());
84 return; 84 return;
85 } 85 }
86 86
87 V8TestInterfaceCustomConstructor::constructorCustom(info); 87 V8TestInterfaceCustomConstructor::constructorCustom(info);
88 } 88 }
89 89
90 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCustomConstructo rTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolat e, WrapperWorldType currentWorldType) 90 static void configureV8TestInterfaceCustomConstructorTemplate(v8::Handle<v8::Fun ctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentW orldType)
91 { 91 {
92 functionTemplate->ReadOnlyPrototype(); 92 functionTemplate->ReadOnlyPrototype();
93 93
94 v8::Local<v8::Signature> defaultSignature; 94 v8::Local<v8::Signature> defaultSignature;
95 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8Test InterfaceCustomConstructor::internalFieldCount, 95 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8Test InterfaceCustomConstructor::internalFieldCount,
96 0, 0, 96 0, 0,
97 0, 0, 97 0, 0,
98 0, 0, 98 0, 0,
99 isolate, currentWorldType); 99 isolate, currentWorldType);
100 functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::construct orCallback); 100 functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::construct orCallback);
101 functionTemplate->SetLength(0); 101 functionTemplate->SetLength(0);
102 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 102 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
103 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 103 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
104 104
105 // Custom toString template 105 // Custom toString template
106 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 106 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
107 return functionTemplate;
108 } 107 }
109 108
110 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCustomConstructor::domTemplate(v 8::Isolate* isolate, WrapperWorldType currentWorldType) 109 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCustomConstructor::domTemplate(v 8::Isolate* isolate, WrapperWorldType currentWorldType)
111 { 110 {
112 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 111 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
113 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 112 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
114 if (result != data->templateMap(currentWorldType).end()) 113 if (result != data->templateMap(currentWorldType).end())
115 return result->value.newLocal(isolate); 114 return result->value.newLocal(isolate);
116 115
117 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 116 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
118 v8::EscapableHandleScope handleScope(isolate); 117 v8::EscapableHandleScope handleScope(isolate);
119 v8::Local<v8::FunctionTemplate> templ = 118 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
120 ConfigureV8TestInterfaceCustomConstructorTemplate(data->rawDOMTemplate(& wrapperTypeInfo, currentWorldType), isolate, currentWorldType); 119 configureV8TestInterfaceCustomConstructorTemplate(templ, isolate, currentWor ldType);
121 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 120 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
122 return handleScope.Escape(templ); 121 return handleScope.Escape(templ);
123 } 122 }
124 123
125 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate, WrapperWorldType currentWorldType) 124 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate, WrapperWorldType currentWorldType)
126 { 125 {
127 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 126 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
128 } 127 }
129 128
130 bool V8TestInterfaceCustomConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Valu e> jsValue, v8::Isolate* isolate) 129 bool V8TestInterfaceCustomConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Valu e> jsValue, v8::Isolate* isolate)
(...skipping 28 matching lines...) Expand all
159 fromInternalPointer(object)->deref(); 158 fromInternalPointer(object)->deref();
160 } 159 }
161 160
162 template<> 161 template<>
163 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate) 162 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
164 { 163 {
165 return toV8(impl, creationContext, isolate); 164 return toV8(impl, creationContext, isolate);
166 } 165 }
167 166
168 } // namespace WebCore 167 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698