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

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

Issue 1828543008: bindings: Fixes the regression of vm_working_set_final_size_total. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); 297 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
298 installMethodInternal(isolate, instance, prototype, interface, signature, me thod, world); 298 installMethodInternal(isolate, instance, prototype, interface, signature, me thod, world);
299 } 299 }
300 300
301 void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::Objec tTemplate> prototypeTemplate, v8::Local<v8::Signature> signature, const SymbolKe yedMethodConfiguration& method) 301 void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::Objec tTemplate> prototypeTemplate, v8::Local<v8::Signature> signature, const SymbolKe yedMethodConfiguration& method)
302 { 302 {
303 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); 303 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
304 installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTem plate, v8::Local<v8::FunctionTemplate>(), signature, method, world); 304 installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTem plate, v8::Local<v8::FunctionTemplate>(), signature, method, world);
305 } 305 }
306 306
307 void V8DOMConfiguration::initializeDOMInterfaceTemplate(v8::Isolate* isolate, v8 ::Local<v8::FunctionTemplate> interfaceTemplate, const char* interfaceName, v8:: Local<v8::FunctionTemplate> parentInterfaceTemplate, size_t v8InternalFieldCount ) 307 v8::Local<v8::Signature> V8DOMConfiguration::installProperties(v8::Isolate* isol ate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplat e> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Loc al<v8::Signature> signature, const AttributeConfiguration attributes[], size_t a ttributeCount, const AccessorConfiguration accessors[], size_t accessorCount, co nst MethodConfiguration methods[], size_t methodCount)
308 {
309 if (attributeCount)
310 installAttributes(isolate, instanceTemplate, prototypeTemplate, attribut es, attributeCount);
311 if (accessorCount)
312 installAccessors(isolate, instanceTemplate, prototypeTemplate, interface Template, signature, accessors, accessorCount);
313 if (methodCount)
314 installMethods(isolate, instanceTemplate, prototypeTemplate, interfaceTe mplate, signature, methods, methodCount);
315 return signature;
316 }
317
318 void V8DOMConfiguration::initializeDOMInterfaceTemplate(v8::Isolate* isolate, v8 ::Local<v8::FunctionTemplate> interfaceTemplate, const char* interfaceName, v8:: Local<v8::FunctionTemplate> parentInterfaceTemplate, v8::Local<v8::ObjectTemplat e> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, size_t v8I nternalFieldCount)
308 { 319 {
309 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName)); 320 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName));
310 interfaceTemplate->ReadOnlyPrototype(); 321 interfaceTemplate->ReadOnlyPrototype();
311 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance Template();
312 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy peTemplate();
313 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount); 322 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount);
314 // TODO(yukishiino): We should set the class string to the platform object 323 // TODO(yukishiino): We should set the class string to the platform object
315 // (|instanceTemplate|), too. The reason that we don't set it is that 324 // (|instanceTemplate|), too. The reason that we don't set it is that
316 // it prevents minor GC to collect unreachable DOM objects (a layout test 325 // it prevents minor GC to collect unreachable DOM objects (a layout test
317 // fast/dom/minor-dom-gc.html fails if we set the class string). 326 // fast/dom/minor-dom-gc.html fails if we set the class string).
318 // See also http://heycam.github.io/webidl/#es-platform-objects 327 // See also http://heycam.github.io/webidl/#es-platform-objects
319 setClassString(isolate, prototypeTemplate, interfaceName); 328 setClassString(isolate, prototypeTemplate, interfaceName);
320 if (!parentInterfaceTemplate.IsEmpty()) { 329 if (!parentInterfaceTemplate.IsEmpty()) {
321 interfaceTemplate->Inherit(parentInterfaceTemplate); 330 interfaceTemplate->Inherit(parentInterfaceTemplate);
322 // Marks the prototype object as one of native-backed objects. 331 // Marks the prototype object as one of native-backed objects.
323 // This is needed since bug 110436 asks WebKit to tell native-initiated prototypes from pure-JS ones. 332 // This is needed since bug 110436 asks WebKit to tell native-initiated prototypes from pure-JS ones.
324 // This doesn't mark kinds "root" classes like Node, where setting this changes prototype chain structure. 333 // This doesn't mark kinds "root" classes like Node, where setting this changes prototype chain structure.
325 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); 334 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount);
326 } 335 }
327 } 336 }
328 337
338 void V8DOMConfiguration::initializeDOMInterfaceTemplate(v8::Isolate* isolate, v8 ::Local<v8::FunctionTemplate> interfaceTemplate, const char* interfaceName, v8:: Local<v8::FunctionTemplate> parentInterfaceTemplate, v8::Local<v8::ObjectTemplat e> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, size_t v8I nternalFieldCount, v8::Local<v8::Signature> signature, const AttributeConfigurat ion attributes[], size_t attributeCount, const AccessorConfiguration accessors[] , size_t accessorCount, const MethodConfiguration methods[], size_t methodCount)
339 {
340 initializeDOMInterfaceTemplate(isolate, interfaceTemplate, interfaceName, pa rentInterfaceTemplate, instanceTemplate, prototypeTemplate, v8InternalFieldCount );
341 installProperties(isolate, instanceTemplate, prototypeTemplate, interfaceTem plate, signature, attributes, attributeCount, accessors, accessorCount, methods, methodCount);
342 }
343
329 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolate * isolate, WrapperTypeInfo* wrapperTypeInfo, void (*configureDOMClassTemplate)(v 8::Local<v8::FunctionTemplate>, v8::Isolate*)) 344 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolate * isolate, WrapperTypeInfo* wrapperTypeInfo, void (*configureDOMClassTemplate)(v 8::Local<v8::FunctionTemplate>, v8::Isolate*))
330 { 345 {
331 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 346 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
332 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(wrapperTy peInfo); 347 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(wrapperTy peInfo);
333 if (!result.IsEmpty()) 348 if (!result.IsEmpty())
334 return result; 349 return result;
335 350
336 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); 351 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
337 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode); 352 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
338 configureDOMClassTemplate(result, isolate); 353 configureDOMClassTemplate(result, isolate);
339 data->setDOMTemplate(wrapperTypeInfo, result); 354 data->setDOMTemplate(wrapperTypeInfo, result);
340 return result; 355 return result;
341 } 356 }
342 357
343 void V8DOMConfiguration::setClassString(v8::Isolate* isolate, v8::Local<v8::Obje ctTemplate> objectTemplate, const char* classString) 358 void V8DOMConfiguration::setClassString(v8::Isolate* isolate, v8::Local<v8::Obje ctTemplate> objectTemplate, const char* classString)
344 { 359 {
345 objectTemplate->Set(v8::Symbol::GetToStringTag(isolate), v8AtomicString(isol ate, classString), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnu m)); 360 objectTemplate->Set(v8::Symbol::GetToStringTag(isolate), v8AtomicString(isol ate, classString), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnu m));
346 } 361 }
347 362
348 } // namespace blink 363 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698