| Index: build/android/pylib/flag_changer.py
|
| diff --git a/build/android/pylib/flag_changer.py b/build/android/pylib/flag_changer.py
|
| index 2cf5ae2fa16d62dd5643ef793482ec1281a1aa3b..c881bdae40af6747bd506d559925b17aacac3473 100644
|
| --- a/build/android/pylib/flag_changer.py
|
| +++ b/build/android/pylib/flag_changer.py
|
| @@ -42,14 +42,7 @@ class FlagChanger(object):
|
| Args:
|
| flags: A list of flags to add on, eg. ['--single-process'].
|
| """
|
| - if flags:
|
| - assert flags[0] != 'chrome'
|
| -
|
| - new_flags = self._state_stack[-1].copy()
|
| - for flag in flags:
|
| - new_flags.add(flag)
|
| - self._state_stack.append(new_flags)
|
| - self._UpdateCommandLineFile()
|
| + self.PushFlags(add=flags)
|
|
|
| def RemoveFlags(self, flags):
|
| """Removes flags from the command line, if they exist.
|
| @@ -65,12 +58,29 @@ class FlagChanger(object):
|
| a switch with a value, you must use the exact string used to add
|
| it in the first place.
|
| """
|
| - if flags:
|
| - assert flags[0] != 'chrome'
|
| + self.PushFlags(remove=flags)
|
|
|
| + def PushFlags(self, add=None, remove=None):
|
| + """Appends and removes flags to/from the command line if they aren't already
|
| + there. Saves the current flags state on the stack, so a call to Restore
|
| + will change the state back to the one preceeding the call to PushFlags.
|
| +
|
| + Args:
|
| + add: A list of flags to add on, eg. ['--single-process'].
|
| + remove: A list of flags to remove, eg. ['--single-process']. Note that we
|
| + expect a complete match when removing flags; if you want to remove
|
| + a switch with a value, you must use the exact string used to add
|
| + it in the first place.
|
| + """
|
| new_flags = self._state_stack[-1].copy()
|
| - for flag in flags:
|
| - new_flags.discard(flag)
|
| + if add:
|
| + assert add[0] != 'chrome'
|
| + for flag in add:
|
| + new_flags.add(flag)
|
| + if remove:
|
| + assert remove[0] != 'chrome'
|
| + for flag in remove:
|
| + new_flags.discard(flag)
|
| self._state_stack.append(new_flags)
|
| self._UpdateCommandLineFile()
|
|
|
|
|