Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Unified Diff: tools/cr/cr/plugin.py

Issue 138253003: [cr tool] Re-run activation until the active set is stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/plugin.py
diff --git a/tools/cr/cr/plugin.py b/tools/cr/cr/plugin.py
index eccd86954aa44abed7249fe8b5677d5b69b78583..824d2c5d8dbeba85d7e5f00eff0b1f046ca3f8b0 100644
--- a/tools/cr/cr/plugin.py
+++ b/tools/cr/cr/plugin.py
@@ -275,13 +275,7 @@ class Plugin(cr.loader.AutoExport):
Returns:
the plugin that is currently active.
"""
- actives = cls.GetAllActive()
- plugin = cls.Select(context)
- for active in actives:
- if active != plugin:
- active.Deactivate()
- if plugin and not plugin.is_active:
- plugin.Activate(context)
+ plugin, _ = _GetActivePlugin(cls, context)
return plugin
@classproperty
@@ -319,8 +313,26 @@ def ChainModuleConfigs(module):
cr.loader.scan_hooks.append(ChainModuleConfigs)
+def _GetActivePlugin(cls, context):
+ activated = False
+ actives = cls.GetAllActive()
+ plugin = cls.Select(context)
+ for active in actives:
+ if active != plugin:
+ active.Deactivate()
+ if plugin and not plugin.is_active:
+ activated = True
+ plugin.Activate(context)
+ return plugin, activated
+
+
def Activate(context):
"""Activates a plugin for all known plugin types."""
types = Plugin.Type.__subclasses__()
- for child in types:
- child.GetActivePlugin(context)
+ modified = True
+ while modified:
+ modified = False
+ for child in types:
+ _, activated = _GetActivePlugin(child, context)
+ if activated:
+ modified = True
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698