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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index 28407c36c90838a291f0e470eef5ef7d57ab0575..95225f5bf85372e9f5545a68e0975be3bb29d245 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -615,12 +615,24 @@ void V8DOMConfiguration::initializeDOMInterfaceTemplate(
v8::Local<v8::ObjectTemplate> prototypeTemplate =
interfaceTemplate->PrototypeTemplate();
instanceTemplate->SetInternalFieldCount(v8InternalFieldCount);
- // TODO(yukishiino): We should set the class string to the platform object
- // (|instanceTemplate|), too. The reason that we don't set it is that
- // it prevents minor GC to collect unreachable DOM objects (a layout test
- // fast/dom/minor-dom-gc.html fails if we set the class string).
- // See also http://heycam.github.io/webidl/#es-platform-objects
+
+ // We intentionally don't set the class string to the platform object
+ // (|instanceTemplate|), and set the class string "InterfaceName", without
+ // "Prototype", to the prototype object (|prototypeTemplate|) despite a fact
+ // that the current WebIDL spec (as of Feb 2017) requires to set the class
+ // string "InterfaceName" for the platform objects and
+ // "InterfaceNamePrototype" for the interface prototype object, because we
+ // think it's more consistent with ECMAScript 2016.
+ // See also https://crbug.com/643712
+ // https://heycam.github.io/webidl/#es-platform-objects
+ // https://heycam.github.io/webidl/#interface-prototype-object
+ //
+ // Note that V8 minor GC does not collect an object which has an own property.
+ // So, if we set the class string to the platform object as an own property,
+ // it prevents V8 minor GC to collect the object (V8 minor GC only collects
+ // an empty object). If set, a layout test fast/dom/minor-dom-gc.html fails.
setClassString(isolate, prototypeTemplate, interfaceName);
+
if (!parentInterfaceTemplate.IsEmpty()) {
interfaceTemplate->Inherit(parentInterfaceTemplate);
// Marks the prototype object as one of native-backed objects.
« 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