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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceConstructor.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 144 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
145 v8SetReturnValue(info, info.Holder()); 145 v8SetReturnValue(info, info.Holder());
146 return; 146 return;
147 } 147 }
148 148
149 TestInterfaceConstructorV8Internal::constructor(info); 149 TestInterfaceConstructorV8Internal::constructor(info);
150 } 150 }
151 151
152 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTempl ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra pperWorldType currentWorldType) 152 static void configureV8TestInterfaceConstructorTemplate(v8::Handle<v8::FunctionT emplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldTy pe)
153 { 153 {
154 functionTemplate->ReadOnlyPrototype(); 154 functionTemplate->ReadOnlyPrototype();
155 155
156 v8::Local<v8::Signature> defaultSignature; 156 v8::Local<v8::Signature> defaultSignature;
157 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf aceConstructor::internalFieldCount, 157 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf aceConstructor::internalFieldCount,
158 0, 0, 158 0, 0,
159 0, 0, 159 0, 0,
160 0, 0, 160 0, 0,
161 isolate, currentWorldType); 161 isolate, currentWorldType);
162 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall back); 162 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall back);
163 functionTemplate->SetLength(0); 163 functionTemplate->SetLength(0);
164 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 164 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
165 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 165 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
166 166
167 // Custom toString template 167 // Custom toString template
168 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 168 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
169 return functionTemplate;
170 } 169 }
171 170
172 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso late* isolate, WrapperWorldType currentWorldType) 171 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso late* isolate, WrapperWorldType currentWorldType)
173 { 172 {
174 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 173 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
175 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 174 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
176 if (result != data->templateMap(currentWorldType).end()) 175 if (result != data->templateMap(currentWorldType).end())
177 return result->value.newLocal(isolate); 176 return result->value.newLocal(isolate);
178 177
179 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 178 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
180 v8::EscapableHandleScope handleScope(isolate); 179 v8::EscapableHandleScope handleScope(isolate);
181 v8::Local<v8::FunctionTemplate> templ = 180 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
182 ConfigureV8TestInterfaceConstructorTemplate(data->rawDOMTemplate(&wrappe rTypeInfo, currentWorldType), isolate, currentWorldType); 181 configureV8TestInterfaceConstructorTemplate(templ, isolate, currentWorldType );
183 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 182 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
184 return handleScope.Escape(templ); 183 return handleScope.Escape(templ);
185 } 184 }
186 185
187 bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate, WrapperWorldType currentWorldType) 186 bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate, WrapperWorldType currentWorldType)
188 { 187 {
189 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 188 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
190 } 189 }
191 190
192 bool V8TestInterfaceConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate) 191 bool V8TestInterfaceConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate)
(...skipping 28 matching lines...) Expand all
221 fromInternalPointer(object)->deref(); 220 fromInternalPointer(object)->deref();
222 } 221 }
223 222
224 template<> 223 template<>
225 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 224 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
226 { 225 {
227 return toV8(impl, creationContext, isolate); 226 return toV8(impl, creationContext, isolate);
228 } 227 }
229 228
230 } // namespace WebCore 229 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698