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

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: 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 const char* interfaceName, 609 const char* interfaceName,
610 v8::Local<v8::FunctionTemplate> parentInterfaceTemplate, 610 v8::Local<v8::FunctionTemplate> parentInterfaceTemplate,
611 size_t v8InternalFieldCount) { 611 size_t v8InternalFieldCount) {
612 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName)); 612 interfaceTemplate->SetClassName(v8AtomicString(isolate, interfaceName));
613 interfaceTemplate->ReadOnlyPrototype(); 613 interfaceTemplate->ReadOnlyPrototype();
614 v8::Local<v8::ObjectTemplate> instanceTemplate = 614 v8::Local<v8::ObjectTemplate> instanceTemplate =
615 interfaceTemplate->InstanceTemplate(); 615 interfaceTemplate->InstanceTemplate();
616 v8::Local<v8::ObjectTemplate> prototypeTemplate = 616 v8::Local<v8::ObjectTemplate> prototypeTemplate =
617 interfaceTemplate->PrototypeTemplate(); 617 interfaceTemplate->PrototypeTemplate();
618 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount); 618 instanceTemplate->SetInternalFieldCount(v8InternalFieldCount);
619 // TODO(yukishiino): We should set the class string to the platform object 619
620 // (|instanceTemplate|), too. The reason that we don't set it is that 620 // We intentionally don't set the class string to the platform object
621 // it prevents minor GC to collect unreachable DOM objects (a layout test 621 // (|instanceTemplate|), and set the class string "InterfaceName", without
622 // fast/dom/minor-dom-gc.html fails if we set the class string). 622 // "Prototype", to the prototype object (|prototypeTemplate|), because we
Matt Giuca 2017/02/05 23:18:08 It seems a bit strange out of context to be saying
Yuki 2017/02/14 12:58:46 Done.
623 // See also http://heycam.github.io/webidl/#es-platform-objects 623 // think it's more consistent with ECMAScript 2016.
624 // See also https://crbug.com/643712
625 //
626 // Note that V8 minor GC does not collect an object which has an own property.
627 // So, if we set the class string to the platform object as an own property,
628 // it prevents V8 minor GC to collect the object (V8 minor GC only collects
629 // an empty object). If set, a layout test fast/dom/minor-dom-gc.html fails.
624 setClassString(isolate, prototypeTemplate, interfaceName); 630 setClassString(isolate, prototypeTemplate, interfaceName);
631
625 if (!parentInterfaceTemplate.IsEmpty()) { 632 if (!parentInterfaceTemplate.IsEmpty()) {
626 interfaceTemplate->Inherit(parentInterfaceTemplate); 633 interfaceTemplate->Inherit(parentInterfaceTemplate);
627 // Marks the prototype object as one of native-backed objects. 634 // Marks the prototype object as one of native-backed objects.
628 // This is needed since bug 110436 asks WebKit to tell native-initiated 635 // This is needed since bug 110436 asks WebKit to tell native-initiated
629 // prototypes from pure-JS ones. This doesn't mark kinds "root" classes 636 // prototypes from pure-JS ones. This doesn't mark kinds "root" classes
630 // like Node, where setting this changes prototype chain structure. 637 // like Node, where setting this changes prototype chain structure.
631 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); 638 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount);
632 } 639 }
633 } 640 }
634 641
(...skipping 18 matching lines...) Expand all
653 void V8DOMConfiguration::setClassString( 660 void V8DOMConfiguration::setClassString(
654 v8::Isolate* isolate, 661 v8::Isolate* isolate,
655 v8::Local<v8::ObjectTemplate> objectTemplate, 662 v8::Local<v8::ObjectTemplate> objectTemplate,
656 const char* classString) { 663 const char* classString) {
657 objectTemplate->Set( 664 objectTemplate->Set(
658 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString), 665 v8::Symbol::GetToStringTag(isolate), v8AtomicString(isolate, classString),
659 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); 666 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
660 } 667 }
661 668
662 } // namespace blink 669 } // 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