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

Side by Side Diff: Source/bindings/core/v8/V8DOMConfiguration.cpp

Issue 823093002: [bindings] Make v8_class::install[v8_class]Template use Local<>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 12 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
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.h ('k') | Source/bindings/templates/interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 installMethod(prototype, signature, attributes, callbacks[i], isolate); 123 installMethod(prototype, signature, attributes, callbacks[i], isolate);
124 } 124 }
125 125
126 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForCallback (v8::Isolate* isolate, v8::Handle<v8::Signature> signature, v8::FunctionCallback callback, int length) 126 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForCallback (v8::Isolate* isolate, v8::Handle<v8::Signature> signature, v8::FunctionCallback callback, int length)
127 { 127 {
128 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New (isolate, callback, v8Undefined(), signature, length); 128 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New (isolate, callback, v8Undefined(), signature, length);
129 functionTemplate->RemovePrototype(); 129 functionTemplate->RemovePrototype();
130 return functionTemplate; 130 return functionTemplate;
131 } 131 }
132 132
133 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate * isolate, v8::Handle<v8::FunctionTemplate> functionDescriptor, const char* inte rfaceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount, 133 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate * isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* inter faceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount,
134 const AttributeConfiguration* attributes, size_t attributeCount, 134 const AttributeConfiguration* attributes, size_t attributeCount,
135 const AccessorConfiguration* accessors, size_t accessorCount, 135 const AccessorConfiguration* accessors, size_t accessorCount,
136 const MethodConfiguration* callbacks, size_t callbackCount) 136 const MethodConfiguration* callbacks, size_t callbackCount)
137 { 137 {
138 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); 138 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName));
139 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc eTemplate(); 139 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc eTemplate();
140 instanceTemplate->SetInternalFieldCount(fieldCount); 140 instanceTemplate->SetInternalFieldCount(fieldCount);
141 if (!parentClass.IsEmpty()) { 141 if (!parentClass.IsEmpty()) {
142 functionDescriptor->Inherit(parentClass); 142 functionDescriptor->Inherit(parentClass);
143 // Marks the prototype object as one of native-backed objects. 143 // Marks the prototype object as one of native-backed objects.
144 // This is needed since bug 110436 asks WebKit to tell native-initiated prototypes from pure-JS ones. 144 // This is needed since bug 110436 asks WebKit to tell native-initiated prototypes from pure-JS ones.
145 // This doesn't mark kinds "root" classes like Node, where setting this changes prototype chain structure. 145 // This doesn't mark kinds "root" classes like Node, where setting this changes prototype chain structure.
146 v8::Local<v8::ObjectTemplate> prototype = functionDescriptor->PrototypeT emplate(); 146 v8::Local<v8::ObjectTemplate> prototype = functionDescriptor->PrototypeT emplate();
147 prototype->SetInternalFieldCount(v8PrototypeInternalFieldcount); 147 prototype->SetInternalFieldCount(v8PrototypeInternalFieldcount);
148 } 148 }
149 149
150 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, func tionDescriptor); 150 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, func tionDescriptor);
151 if (attributeCount) 151 if (attributeCount)
152 installAttributes(isolate, instanceTemplate, functionDescriptor->Prototy peTemplate(), attributes, attributeCount); 152 installAttributes(isolate, instanceTemplate, functionDescriptor->Prototy peTemplate(), attributes, attributeCount);
153 if (accessorCount) 153 if (accessorCount)
154 installAccessors(isolate, functionDescriptor->PrototypeTemplate(), defau ltSignature, accessors, accessorCount); 154 installAccessors(isolate, functionDescriptor->PrototypeTemplate(), defau ltSignature, accessors, accessorCount);
155 if (callbackCount) 155 if (callbackCount)
156 installMethods(isolate, functionDescriptor->PrototypeTemplate(), default Signature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callba ckCount); 156 installMethods(isolate, functionDescriptor->PrototypeTemplate(), default Signature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callba ckCount);
157 return defaultSignature; 157 return defaultSignature;
158 } 158 }
159 159
160 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolat e* isolate, WrapperTypeInfo* wrapperTypeInfo, void (*configureDOMClassTemplate)( v8::Handle<v8::FunctionTemplate>, v8::Isolate*)) 160 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolat e* isolate, WrapperTypeInfo* wrapperTypeInfo, void (*configureDOMClassTemplate)( v8::Local<v8::FunctionTemplate>, v8::Isolate*))
161 { 161 {
162 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 162 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
163 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(wrapperTy peInfo); 163 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(wrapperTy peInfo);
164 if (!result.IsEmpty()) 164 if (!result.IsEmpty())
165 return result; 165 return result;
166 166
167 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); 167 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
168 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode); 168 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
169 configureDOMClassTemplate(result, isolate); 169 configureDOMClassTemplate(result, isolate);
170 data->setDOMTemplate(wrapperTypeInfo, result); 170 data->setDOMTemplate(wrapperTypeInfo, result);
171 return result; 171 return result;
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.h ('k') | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698