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

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

Issue 1685543002: Supports "class string" based on @@toStringTag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 4 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
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 6399a5b5f905e718c0ff2e5b7ebd55c4dca60163..380e9409b55660dcb30ec4599a76c52d700b2988 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -313,6 +313,12 @@ v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->InstanceTemplate();
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->PrototypeTemplate();
instanceTemplate->SetInternalFieldCount(fieldCount);
+ // TODO(yukishiino): We should set the class string to the platform object
+ // (|instanceTemplate|), too. The reason that we don't set it is that
adamk 2016/02/12 18:31:33 Can you say more about exactly what this patch doe
+ // 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
caitp (gmail) 2016/02/12 14:44:46 Has there been more discussion about this since ht
+ setClassString(isolate, prototypeTemplate, interfaceName);
if (!parentClass.IsEmpty()) {
functionDescriptor->Inherit(parentClass);
// Marks the prototype object as one of native-backed objects.
@@ -345,4 +351,9 @@ v8::Local<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolate
return result;
}
+void V8DOMConfiguration::setClassString(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> objectTemplate, const char* classString)
+{
+ objectTemplate->Set(v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698