Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / tools / telemetry / catapult_base / refactor / annotated_symbol / base_symbol.py
blob80fbc0b0fb06e18b102af1a590fb755ea8937103
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from catapult_base.refactor import snippet
8 class AnnotatedSymbol(snippet.Symbol):
9 def __init__(self, symbol_type, children):
10 super(AnnotatedSymbol, self).__init__(symbol_type, children)
11 self._modified = False
13 @property
14 def modified(self):
15 if self._modified:
16 return True
17 return super(AnnotatedSymbol, self).modified
19 def __setattr__(self, name, value):
20 if (hasattr(self.__class__, name) and
21 isinstance(getattr(self.__class__, name), property)):
22 self._modified = True
23 return super(AnnotatedSymbol, self).__setattr__(name, value)
25 def Cut(self, child):
26 for i in xrange(len(self._children)):
27 if self._children[i] == child:
28 self._modified = True
29 del self._children[i]
30 break
31 else:
32 raise ValueError('%s is not in %s.' % (child, self))
34 def Paste(self, child):
35 self._modified = True
36 self._children.append(child)