diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-07-11 10:20:10 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-16 09:13:39 +0000 |
commit | ff6984e3b07f5d70aa7250991f6ff700004ddcde (patch) | |
tree | 6b09b93a161198e2f49d594ee49034b425c04734 | |
parent | c305eb631e5f6a71690c1ac3eb226e94e5619296 (diff) | |
download | buildstream-ff6984e3b07f5d70aa7250991f6ff700004ddcde.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.py | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index c8243e6c0..faf97a52e 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -2261,9 +2261,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 # @@ -2958,38 +2969,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 |