diff options
Diffstat (limited to 'systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py')
-rw-r--r-- | systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py b/systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py new file mode 100644 index 0000000..4ede79b --- /dev/null +++ b/systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py @@ -0,0 +1,16 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import types + +from py_trace_event.trace_event_impl import decorators + + +class TracedMetaClass(type): + def __new__(cls, name, bases, attrs): + for attr_name, attr_value in attrs.iteritems(): + if isinstance(attr_value, types.FunctionType): + attrs[attr_name] = decorators.traced(attr_value) + + return super(TracedMetaClass, cls).__new__(cls, name, bases, attrs) |