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

Unified Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 26792002: Reland: Reland: Implement new Blink IDL attribute [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index 042e5f97fd3149d14930de207a6155e614009413..8e108884dc72d6878d924fd085893b7a217f794f 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -114,6 +114,7 @@ use Cwd;
use File::Basename;
use File::Find;
use File::Spec;
+use Data::Dumper;
haraken 2013/10/10 06:08:32 Remove this.
my $idlDocument;
my $idlDirectories;
@@ -454,13 +455,13 @@ sub HeaderFilesForInterface
return @includes;
}
-sub NeedsOpaqueRootForGC
+sub NeedResolveWrapperReachability
{
my $interface = shift;
- return $interface->extendedAttributes->{"GenerateIsReachable"} || $interface->extendedAttributes->{"CustomIsReachable"};
+ return $interface->extendedAttributes->{"GenerateIsReachable"} || $interface->extendedAttributes->{"CustomIsReachable"} || $interface->extendedAttributes->{"ReachableTo"};
}
-sub GenerateOpaqueRootForGC
+sub GenerateResolveWrapperReachability
{
my $interface = shift;
my $implClassName = GetImplName($interface);
@@ -471,10 +472,17 @@ sub GenerateOpaqueRootForGC
}
my $code = <<END;
-void* ${v8ClassName}::opaqueRootForGC(void* object, v8::Isolate* isolate)
+void* ${v8ClassName}::resolveWrapperReachability(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
{
${implClassName}* impl = fromInternalPointer(object);
END
+ for my $reachableTo (@{$interface->extendedAttributes->{"ReachableTo"}}) {
+ $code .= <<END;
+ // isolate->SetReference(wrapper, toV8(impl->filter(), wrapper, isolate));
+END
+ warn Dumper($reachableTo->type);
+ }
+
my $isReachableMethod = $interface->extendedAttributes->{"GenerateIsReachable"};
if ($isReachableMethod) {
AddToImplIncludes("bindings/v8/V8GCController.h");
@@ -652,8 +660,8 @@ END
static WrapperTypeInfo info;
END
- if (NeedsOpaqueRootForGC($interface)) {
- $header{classPublic}->add(" static void* opaqueRootForGC(void*, v8::Isolate*);\n");
+ if (NeedResolveWrapperReachability($interface)) {
+ $header{classPublic}->add(" static void* resolveWrapperReachability(void*, const v8::Persistent<v8::Object>&, v8::Isolate*);\n");
}
if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
@@ -3941,7 +3949,7 @@ sub GenerateImplementation
my $toActiveDOMObject = InheritsExtendedAttribute($interface, "ActiveDOMObject") ? "${v8ClassName}::toActiveDOMObject" : "0";
my $toEventTarget = InheritsInterface($interface, "EventTarget") ? "${v8ClassName}::toEventTarget" : "0";
- my $rootForGC = NeedsOpaqueRootForGC($interface) ? "${v8ClassName}::opaqueRootForGC" : "0";
+ my $resolveWrapperReachability = NeedResolveWrapperReachability($interface) ? "${v8ClassName}::resolveWrapperReachability" : "0";
# Find the super descriptor.
my $parentClass = "";
@@ -3991,7 +3999,7 @@ END
}
my $code = "WrapperTypeInfo ${v8ClassName}::info = { ${v8ClassName}::GetTemplate, ${v8ClassName}::derefObject, $toActiveDOMObject, $toEventTarget, ";
- $code .= "$rootForGC, ${v8ClassName}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n";
+ $code .= "$resolveWrapperReachability, ${v8ClassName}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n";
$implementation{nameSpaceWebCore}->addHeader($code);
$implementation{nameSpaceInternal}->add("template <typename T> void V8_USE(T) { }\n\n");
@@ -4048,8 +4056,8 @@ END
GenerateReplaceableAttributeSetterCallback($interface);
}
- if (NeedsOpaqueRootForGC($interface)) {
- GenerateOpaqueRootForGC($interface);
+ if (NeedResolveWrapperReachability($interface)) {
+ GenerateResolveWrapperReachability($interface);
}
if ($interface->extendedAttributes->{"CheckSecurity"} && $interface->name ne "Window") {

Powered by Google App Engine
This is Rietveld 408576698