Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 use strict; | |
|
sof
2016/02/09 15:45:45
Intentional inclusion of this file?
| |
| 2 | |
| 3 my %willbe_types1 = ( | |
| 4 PassRefPtrWillBeRawPtr => "RawPtr", | |
| 5 PassOwnPtrWillBeRawPtr => "RawPtr", | |
| 6 WillBeGarbageCollectedObject => "XXXXXX", | |
| 7 ); | |
| 8 | |
| 9 my %willbe_types2 = ( | |
| 10 RefCountedWillBeGarbageCollected => "GarbageCollected", | |
| 11 RefCountedWillBeGarbageCollectedFinalized => "GarbageCollec tedFinalized", | |
| 12 RefCountedWillBeRefCountedGarbageCollected => "RefCountedGa rbageCollected", | |
| 13 RefCountedGarbageCollectedWillBeGarbageCollectedFinalized = > "GarbageCollectedFinalized", | |
| 14 RefCountedWillBeNoBase => "DummyBase", | |
| 15 RefCountedGarbageCollectedWillBeNoBase => "DummyBase", | |
| 16 ThreadSafeRefCountedWillBeGarbageCollected => "GarbageColle cted", | |
| 17 ThreadSafeRefCountedWillBeGarbageCollectedFinalized => "Gar bageCollectedFinalized", | |
| 18 PersistentWillBeMember => "Member", | |
| 19 CrossThreadPersistentWillBeMember => "Member", | |
| 20 RefPtrWillBePersistent => "Persistent", | |
| 21 RefPtrWillBeRawPtr => "RawPtr", | |
| 22 RefPtrWillBeMember => "Member", | |
| 23 RefPtrWillBeWeakMember => "WeakMember", | |
| 24 RefPtrWillBeWeakPersistent => "WeakPersistent", | |
| 25 RefPtrWillBeCrossThreadPersistent => "CrossThreadPersistent ", | |
| 26 RawPtrWillBeMember => "Member", | |
| 27 RawPtrWillBePersistent => "Persistent", | |
| 28 RawPtrWillBeWeakMember => "WeakMember", | |
| 29 RawPtrWillBeWeakPersistent => "WeakPersistent", | |
| 30 RawPtrWillBeUntracedMember => "UntracedMember", | |
| 31 OwnPtrWillBeCrossThreadPersistent => "CrossThreadPersistent ", | |
| 32 OwnPtrWillBeMember => "Member", | |
| 33 OwnPtrWillBePersistent => "Persistent", | |
| 34 OwnPtrWillBeRawPtr => "RawPtr", | |
| 35 WeakPtrWillBeCrossThreadWeakPersistent => "CrossThreadWeakP ersistent", | |
| 36 WeakPtrWillBeMember => "Member", | |
| 37 WeakPtrWillBeRawPtr => "RawPtr", | |
| 38 WeakPtrWillBeWeakMember => "WeakMember", | |
| 39 WeakPtrWillBeWeakPersistent => "WeakPersistent", | |
| 40 NoBaseWillBeGarbageCollected => "GarbageCollected", | |
| 41 NoBaseWillBeGarbageCollectedFinalized => "GarbageCollectedF inalized", | |
| 42 NoBaseWillBeRefCountedGarbageCollected => "RefCountedGarbag eCollected", | |
| 43 PersistentHeapHashMapWillBeHeapHashMap => "HeapHashMap", | |
| 44 PersistentHeapHashSetWillBeHeapHashSet => "HeapHashSet", | |
| 45 PersistentHeapDequeWillBeHeapDeque => "HeapDeque", | |
| 46 PersistentHeapVectorWillBeHeapVector => "HeapVector", | |
| 47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN => "USING_GARBAGE_COL LECTED_MIXIN", | |
| 48 WILL_BE_USING_PRE_FINALIZER => "USING_PRE_FINALIZER", | |
| 49 ); | |
| 50 | |
| 51 my %willbe_types3 = ( | |
| 52 WillBeGarbageCollected => "GarbageCollected", | |
| 53 WillBeHeapHashMap => "HeapHashMap", | |
| 54 WillBePersistentHeapHashMap => "PersistentHeapHashMap", | |
| 55 WillBeHeapHashSet => "HeapHashSet", | |
| 56 WillBePersistentHeapHashSet => "PersistentHeapHashSet", | |
| 57 WillBeHeapLinkedHashSet => "HeapLinkedHashSet", | |
| 58 WillBePersistentHeapLinkedHashSet => "PersistentHeapLinkedH ashSet", | |
| 59 WillBeHeapListHashSet => "HeapListHashSet", | |
| 60 WillBePersistentHeapListHashSet => "PersistentHeapListHashS et", | |
| 61 WillBeHeapVector => "HeapVector", | |
| 62 WillBePersistentHeapVector => "PersistentHeapVector", | |
| 63 WillBeHeapDeque => "HeapDeque", | |
| 64 WillBePersistentHeapDeque => "PersistentHeapDeque", | |
| 65 WillBeHeapHashCountedSet => "HeapHashCountedSet", | |
| 66 WillBePersistentHeapHashCountedSet => "PersistentHeapHashCo untedSet", | |
| 67 WillBeGarbageCollectedMixin => "GarbageCollectedMixin", | |
| 68 WillBeHeapSupplement => "HeapSupplement", | |
| 69 WillBeHeapSupplementable => "HeapSupplementable", | |
| 70 WillBeHeapTerminatedArray => "HeapTerminatedArray", | |
| 71 WillBeHeapTerminatedArrayBuilder => "HeapTerminatedArrayBui lder", | |
| 72 WillBeHeapLinkedStack => "HeapLinkedStack", | |
| 73 ); | |
| 74 | |
| 75 my %willbe_types4 = ( | |
| 76 XXXXXX => "WillBeGarbageCollectedObject", | |
| 77 ); | |
| 78 | |
| 79 my @removed_macros = qw( | |
| 80 USING_FAST_MALLOC_WILL_BE_REMOVED | |
| 81 USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED | |
| 82 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED | |
| 83 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED | |
| 84 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED | |
| 85 EAGERLY_FINALIZE_WILL_BE_REMOVED | |
| 86 ); | |
| 87 | |
| 88 my @adoptref_types = qw( | |
| 89 adoptRefWillBeNoop | |
| 90 adoptPtrWillBeNoop | |
| 91 ); | |
| 92 | |
| 93 for my $key (keys %willbe_types1) { | |
| 94 my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platfo rm/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types1{$key} . "/g'"; | |
| 95 print $command , $/; | |
| 96 system $command; | |
| 97 } | |
| 98 | |
| 99 for my $key (keys %willbe_types2) { | |
| 100 my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platfo rm/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types2{$key} . "/g'"; | |
| 101 print $command , $/; | |
| 102 system $command; | |
| 103 } | |
| 104 | |
| 105 for my $key (keys %willbe_types3) { | |
| 106 my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platfo rm/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types3{$key} . "/g'"; | |
| 107 print $command , $/; | |
| 108 system $command; | |
| 109 } | |
| 110 | |
| 111 for my $key (keys %willbe_types4) { | |
| 112 my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platfo rm/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types4{$key} . "/g'"; | |
| 113 print $command , $/; | |
| 114 system $command; | |
| 115 } | |
| 116 | |
| 117 my $command = "grep -rl DummyBase | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/public\\s\\+DummyBase<\\([^>]\\+\\)>,\\?\\s\\+//g'"; | |
| 118 print $command, $/; | |
| 119 system $command; | |
| 120 my @files = `grep -rl 'DummyBase<' | grep -v '\\.pl' | grep -v 'platform/heap/'` ; | |
| 121 die if @files; | |
| 122 | |
| 123 for my $macro (@removed_macros) { | |
| 124 my $command = "grep -rl '" . $macro . "' * | grep -v '\\.pl' | grep -v 'plat form/heap/'"; | |
| 125 print $command, $/; | |
| 126 my @files = `$command`; | |
| 127 for my $file (@files) { | |
| 128 my $str = ""; | |
| 129 my $skipped = 0; | |
| 130 print $file; | |
| 131 chomp $file; | |
| 132 open FH, "<", $file or die; | |
| 133 while (my $line = <FH>) { | |
| 134 if ($skipped && $line =~ /^[\s\t]*\n$/) { | |
| 135 next; | |
| 136 } | |
| 137 $skipped = 0; | |
| 138 if ($line =~ /${macro}/) { | |
| 139 if ($line =~ /^[\s\t]*${macro}(\([^()]*\))?;?\s*\n$/) { | |
| 140 $skipped = 1; | |
| 141 next; | |
| 142 } else { | |
| 143 $line =~ s/[\s\t]*${macro}(\([^()]*\))?;?//; | |
| 144 } | |
| 145 } | |
| 146 $str .= $line; | |
| 147 } | |
| 148 close FH; | |
| 149 open FH, ">", $file or die; | |
| 150 print FH $str; | |
| 151 close FH; | |
| 152 } | |
| 153 } | |
| 154 | |
| 155 my $openclose; | |
| 156 $openclose = qr/\([^()]*(?:(??{$openclose})[^()]*)*\)/; | |
| 157 for my $type (@adoptref_types) { | |
| 158 my $command = "grep -rl '" . $type . "' * | grep -v '\\.pl' | grep -v 'platf orm/heap/'"; | |
| 159 print $command, $/; | |
| 160 my @files = `$command`; | |
| 161 for my $file (@files) { | |
| 162 print $file; | |
| 163 chomp $file; | |
| 164 open FH, "<", $file or die; | |
| 165 my @lines = <FH>; | |
| 166 my $str = join "", @lines; | |
| 167 $str =~ s/${type}\s*($openclose)/\1/mg; | |
| 168 close FH; | |
| 169 open FH, ">", $file or die; | |
| 170 print FH $str; | |
| 171 close FH; | |
| 172 } | |
| 173 } | |
| OLD | NEW |