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

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

Issue 94833002: Remove usage of deprecated V8 APIs from bindings code generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 { 120 {
121 // This is only for getting a unique pointer which we can pass to privateTem plate. 121 // This is only for getting a unique pointer which we can pass to privateTem plate.
122 static int privateTemplateUniqueKey; 122 static int privateTemplateUniqueKey;
123 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 123 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
124 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr entWorldType, &privateTemplateUniqueKey); 124 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr entWorldType, &privateTemplateUniqueKey);
125 if (!result.IsEmpty()) 125 if (!result.IsEmpty())
126 return result; 126 return result;
127 127
128 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 128 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
129 v8::HandleScope scope(isolate); 129 v8::HandleScope scope(isolate);
130 result = v8::FunctionTemplate::New(V8TestNamedConstructorConstructorCallback ); 130 result = v8::FunctionTemplate::New(isolate, V8TestNamedConstructorConstructo rCallback);
131 131
132 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); 132 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
133 instanceTemplate->SetInternalFieldCount(V8TestNamedConstructor::internalFiel dCount); 133 instanceTemplate->SetInternalFieldCount(V8TestNamedConstructor::internalFiel dCount);
134 result->SetClassName(v8::String::NewSymbol("TestNamedConstructor")); 134 result->SetClassName(v8::String::NewFromUtf8(isolate, "TestNamedConstructor" , v8::String::kInternalizedString));
135 result->Inherit(V8TestNamedConstructor::GetTemplate(isolate, currentWorldTyp e)); 135 result->Inherit(V8TestNamedConstructor::GetTemplate(isolate, currentWorldTyp e));
136 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result ); 136 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result );
137 137
138 return scope.Close(result); 138 return scope.Close(result);
139 } 139 }
140 140
141 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestNamedConstructorTemplate( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType) 141 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestNamedConstructorTemplate( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType)
142 { 142 {
143 functionTemplate->ReadOnlyPrototype(); 143 functionTemplate->ReadOnlyPrototype();
144 144
145 v8::Local<v8::Signature> defaultSignature; 145 v8::Local<v8::Signature> defaultSignature;
146 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestNamedConstructor", v8::Local<v8::FunctionTemplate>(), V8TestNamedConst ructor::internalFieldCount, 146 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestNamedConstructor", v8::Local<v8::FunctionTemplate>(), V8TestNamedConst ructor::internalFieldCount,
147 0, 0, 147 0, 0,
148 0, 0, 148 0, 0,
149 0, 0, 149 0, 0,
150 isolate, currentWorldType); 150 isolate, currentWorldType);
151 UNUSED_PARAM(defaultSignature); 151 UNUSED_PARAM(defaultSignature);
152 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); 152 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate();
153 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); 153 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate();
154 UNUSED_PARAM(instanceTemplate); 154 UNUSED_PARAM(instanceTemplate);
155 UNUSED_PARAM(prototypeTemplate); 155 UNUSED_PARAM(prototypeTemplate);
156 156
157 // Custom toString template 157 // Custom toString template
158 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c urrent()->toStringTemplate()); 158 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
159 return functionTemplate; 159 return functionTemplate;
160 } 160 }
161 161
162 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructor::GetTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType) 162 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructor::GetTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType)
163 { 163 {
164 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 164 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
165 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 165 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
166 if (result != data->templateMap(currentWorldType).end()) 166 if (result != data->templateMap(currentWorldType).end())
167 return result->value.newLocal(isolate); 167 return result->value.newLocal(isolate);
168 168
169 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 169 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
170 v8::HandleScope handleScope(isolate); 170 v8::EscapableHandleScope handleScope(isolate);
171 v8::Handle<v8::FunctionTemplate> templ = 171 v8::Local<v8::FunctionTemplate> templ =
172 ConfigureV8TestNamedConstructorTemplate(data->rawTemplate(&wrapperTypeIn fo, currentWorldType), isolate, currentWorldType); 172 ConfigureV8TestNamedConstructorTemplate(data->rawTemplate(&wrapperTypeIn fo, currentWorldType), isolate, currentWorldType);
173 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 173 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
174 return handleScope.Close(templ); 174 return handleScope.Escape(templ);
175 } 175 }
176 176
177 bool V8TestNamedConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType) 177 bool V8TestNamedConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType)
178 { 178 {
179 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 179 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
180 } 180 }
181 181
182 bool V8TestNamedConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate) 182 bool V8TestNamedConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
183 { 183 {
184 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld) 184 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 fromInternalPointer(object)->deref(); 216 fromInternalPointer(object)->deref();
217 } 217 }
218 218
219 template<> 219 template<>
220 v8::Handle<v8::Value> toV8NoInline(TestNamedConstructor* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate) 220 v8::Handle<v8::Value> toV8NoInline(TestNamedConstructor* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
221 { 221 {
222 return toV8(impl, creationContext, isolate); 222 return toV8(impl, creationContext, isolate);
223 } 223 }
224 224
225 } // namespace WebCore 225 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceImplementedAs.cpp ('k') | Source/bindings/tests/results/V8TestNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698