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

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

Issue 2669263004: binding: Updates a comment of the class string on the platform objects. (Closed)
Patch Set: Addressed a review comment. Created 3 years, 10 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 | « no previous file | no next file » | 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 const char* interfaceName, 608 const char* interfaceName,
609 v8::Local<v8::FunctionTemplate> parentInterfaceTemplate, 609 v8::Local<v8::FunctionTemplate> parentInterfaceTemplate,
610 size_t v8InternalFieldCount) { 610 size_t v8InternalFieldCount) {
611 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName)); 611 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName));
612 interfaceTemplate->ReadOnlyPrototype(); 612 interfaceTemplate->ReadOnlyPrototype();
613 v8::Local<v8::ObjectTemplate> instanceTemplate = 613 v8::Local<v8::ObjectTemplate> instanceTemplate =
614 interfaceTemplate->InstanceTemplate(); 614 interfaceTemplate->InstanceTemplate();
615 v8::Local<v8::ObjectTemplate> prototypeTemplate = 615 v8::Local<v8::ObjectTemplate> prototypeTemplate =
616 interfaceTemplate->PrototypeTemplate(); 616 interfaceTemplate->PrototypeTemplate();
617 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount); 617 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount);
618 // TODO(yukishiino): We should set the class string to the platform object 618
619 // (|instanceTemplate|), too. The reason that we don't set it is that 619 // We intentionally don't set the class string to the platform object
620 // it prevents minor GC to collect unreachable DOM objects (a layout test 620 // (|instanceTemplate|), and set the class string "InterfaceName", without
621 // fast/dom/minor-dom-gc.html fails if we set the class string). 621 // "Prototype", to the prototype object (|prototypeTemplate|) despite a fact
622 // See also http://heycam.github.io/webidl/#es-platform-objects 622 // that the current WebIDL spec (as of Feb 2017) requires to set the class
623 // string "InterfaceName" for the platform objects and
624 // "InterfaceNamePrototype" for the interface prototype object, because we
625 // think it's more consistent with ECMAScript 2016.
626 // See also https://crbug.com/643712
627 // https://heycam.github.io/webidl/#es-platform-objects
628 // https://heycam.github.io/webidl/#interface-prototype-object
629 //
630 // Note that V8 minor GC does not collect an object which has an own property.
631 // So, if we set the class string to the platform object as an own property,
632 // it prevents V8 minor GC to collect the object (V8 minor GC only collects
633 // an empty object). If set, a layout test fast/dom/minor-dom-gc.html fails.
623 setClassString(isolate, prototypeTemplate, interfaceName); 634 setClassString(isolate, prototypeTemplate, interfaceName);
635
624 if (!parentInterfaceTemplate.IsEmpty()) { 636 if (!parentInterfaceTemplate.IsEmpty()) {
625 interfaceTemplate->Inherit(parentInterfaceTemplate); 637 interfaceTemplate->Inherit(parentInterfaceTemplate);
626 // Marks the prototype object as one of native-backed objects. 638 // Marks the prototype object as one of native-backed objects.
627 // This is needed since bug 110436 asks WebKit to tell native-initiated 639 // This is needed since bug 110436 asks WebKit to tell native-initiated
628 // prototypes from pure-JS ones. This doesn't mark kinds "root" classes 640 // prototypes from pure-JS ones. This doesn't mark kinds "root" classes
629 // like Node, where setting this changes prototype chain structure. 641 // like Node, where setting this changes prototype chain structure.
630 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); 642 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount);
631 } 643 }
632 } 644 }
633 645
(...skipping 18 matching lines...) Expand all
652 void V8DOMConfiguration::setClassString( 664 void V8DOMConfiguration::setClassString(
653 v8::Isolate* isolate, 665 v8::Isolate* isolate,
654 v8::Local<v8::ObjectTemplate> objectTemplate, 666 v8::Local<v8::ObjectTemplate> objectTemplate,
655 const char* classString) { 667 const char* classString) {
656 objectTemplate->Set( 668 objectTemplate->Set(
657 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString), 669 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString),
658 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); 670 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
659 } 671 }
660 672
661 } // namespace blink 673 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698