summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-07-11 10:20:10 +0100
committerJames Ennis <james.ennis@codethink.co.uk>2019-07-11 10:20:10 +0100
commit73fe0246ae095ade7bd724bcfa67a2dfa5bd8f7b (patch)
tree8efed8df8145f82634cfe76f4fa602450a74a607
parent372f04a22ef87ac981a7c1751ea9f3e6e16cc544 (diff)
downloadbuildstream-73fe0246ae095ade7bd724bcfa67a2dfa5bd8f7b.tar.gz
element.py: Remove needless function overhead
This patch inlines the __on_{build,runtime}_dependency_ready_for_runtime_and_cached() functions. Their logic now exists within _update_ready_for_runtime_and_cached, thus the overhead of the extra functions have been removed.
-rw-r--r--src/buildstream/element.py47
1 files changed, 13 insertions, 34 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index daf5fb277..ee12c1747 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2310,9 +2310,20 @@ class Element(Plugin):
# Notify reverse dependencies
for rdep in self.__reverse_runtime_deps:
- rdep.__on_runtime_dependency_ready_for_runtime_and_cached()
+ rdep.__runtime_deps_uncached -= 1
+ assert not rdep.__runtime_deps_uncached < 0
+
+ # Try to notify reverse dependencies if all runtime deps are ready
+ if rdep.__runtime_deps_uncached == 0:
+ rdep._update_ready_for_runtime_and_cached()
+
for rdep in self.__reverse_build_deps:
- rdep.__on_build_dependency_ready_for_runtime_and_cached()
+ rdep.__build_deps_uncached -= 1
+ assert not rdep.__build_deps_uncached < 0
+
+ if rdep.__buildable_callback is not None and rdep._buildable():
+ rdep.__buildable_callback(rdep)
+ rdep.__buildable_callback = None
#############################################################
# Private Local Methods #
@@ -3003,38 +3014,6 @@ class Element(Plugin):
for rdep in element.__reverse_build_deps | element.__reverse_runtime_deps:
queue.push(rdep._unique_id, rdep)
- # __on_runtime_dependency_ready_for_runtime_and_cached()
- #
- # This function is called once one of the Element's runtime dependencies has
- # become ready for runtime and cached.
- #
- # On calling this function, we decrement the Element's remaining runtime deps counter.
- # If this is zero, we attempt to notify all reverse dependencies of the Element.
- #
- def __on_runtime_dependency_ready_for_runtime_and_cached(self):
- self.__runtime_deps_uncached -= 1
- assert not self.__runtime_deps_uncached < 0
-
- # Try to notify reverse dependencies if all runtime deps are ready
- if self.__runtime_deps_uncached == 0:
- self._update_ready_for_runtime_and_cached()
-
- # __on_build_dependency_ready_for_runtime_and_cached()
- #
- # This function is called once one of the Element's build dependencies has become
- # ready for runtime and cached.
- #
- # On calling this function, we decrement the Element's remaining build deps counter.
- # If this is zero, we invoke the buildable callback.
- #
- def __on_build_dependency_ready_for_runtime_and_cached(self):
- self.__build_deps_uncached -= 1
- assert not self.__build_deps_uncached < 0
-
- if self.__buildable_callback is not None and self._buildable():
- self.__buildable_callback(self)
- self.__buildable_callback = None
-
# __reset_cache_data()
#
# Resets all data related to cache key calculation and whether an artifact