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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceConstructor2.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 131 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
132 v8SetReturnValue(info, info.Holder()); 132 v8SetReturnValue(info, info.Holder());
133 return; 133 return;
134 } 134 }
135 135
136 TestInterfaceConstructor2V8Internal::constructor(info); 136 TestInterfaceConstructor2V8Internal::constructor(info);
137 } 137 }
138 138
139 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructor2Temp late(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wr apperWorldType currentWorldType) 139 static void configureV8TestInterfaceConstructor2Template(v8::Handle<v8::Function Template> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldT ype)
140 { 140 {
141 functionTemplate->ReadOnlyPrototype(); 141 functionTemplate->ReadOnlyPrototype();
142 142
143 v8::Local<v8::Signature> defaultSignature; 143 v8::Local<v8::Signature> defaultSignature;
144 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInter faceConstructor2::internalFieldCount, 144 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInter faceConstructor2::internalFieldCount,
145 0, 0, 145 0, 0,
146 0, 0, 146 0, 0,
147 0, 0, 147 0, 0,
148 isolate, currentWorldType); 148 isolate, currentWorldType);
149 functionTemplate->SetCallHandler(V8TestInterfaceConstructor2::constructorCal lback); 149 functionTemplate->SetCallHandler(V8TestInterfaceConstructor2::constructorCal lback);
150 functionTemplate->SetLength(1); 150 functionTemplate->SetLength(1);
151 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 151 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
152 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 152 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
153 153
154 // Custom toString template 154 // Custom toString template
155 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 155 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
156 return functionTemplate;
157 } 156 }
158 157
159 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor2::domTemplate(v8::Is olate* isolate, WrapperWorldType currentWorldType) 158 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor2::domTemplate(v8::Is olate* isolate, WrapperWorldType currentWorldType)
160 { 159 {
161 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 160 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
162 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 161 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
163 if (result != data->templateMap(currentWorldType).end()) 162 if (result != data->templateMap(currentWorldType).end())
164 return result->value.newLocal(isolate); 163 return result->value.newLocal(isolate);
165 164
166 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 165 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
167 v8::EscapableHandleScope handleScope(isolate); 166 v8::EscapableHandleScope handleScope(isolate);
168 v8::Local<v8::FunctionTemplate> templ = 167 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
169 ConfigureV8TestInterfaceConstructor2Template(data->rawDOMTemplate(&wrapp erTypeInfo, currentWorldType), isolate, currentWorldType); 168 configureV8TestInterfaceConstructor2Template(templ, isolate, currentWorldTyp e);
170 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 169 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
171 return handleScope.Escape(templ); 170 return handleScope.Escape(templ);
172 } 171 }
173 172
174 bool V8TestInterfaceConstructor2::hasInstance(v8::Handle<v8::Value> jsValue, v8: :Isolate* isolate, WrapperWorldType currentWorldType) 173 bool V8TestInterfaceConstructor2::hasInstance(v8::Handle<v8::Value> jsValue, v8: :Isolate* isolate, WrapperWorldType currentWorldType)
175 { 174 {
176 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 175 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
177 } 176 }
178 177
179 bool V8TestInterfaceConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Value> js Value, v8::Isolate* isolate) 178 bool V8TestInterfaceConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Value> js Value, v8::Isolate* isolate)
(...skipping 28 matching lines...) Expand all
208 fromInternalPointer(object)->deref(); 207 fromInternalPointer(object)->deref();
209 } 208 }
210 209
211 template<> 210 template<>
212 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate) 211 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate)
213 { 212 {
214 return toV8(impl, creationContext, isolate); 213 return toV8(impl, creationContext, isolate);
215 } 214 }
216 215
217 } // namespace WebCore 216 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698