New issue
Advanced search Search tips

Issue 877209 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Bug



Sign in to add a comment

[iOS] Make ChromeCoordinator's |-start| and |-stop| idempotent.

Project Member Reported by kkhorimoto@chromium.org, Aug 23

Issue description

There are multiple coordinators in which |-start| and |-stop| need to be idempotent, and they implement a self.started property to allow returning early to prevent code from being run multiple times.  For example, if a coordinator needs to observe a KeyedService for its lifecycle, then attempting to remove itself as an observer in |-stop| twice would cause a crash.  This is particularly likely since ChromeCoordinator calls |-stop| in |-dealloc|.  ChromeCoordinator should be updated to track whether it's been started and early return appropriately in these selectors.  Subclasses could then add functionality in |-willStart|, |-didStart|, |-willStop|, and |-didStop|.
 
Cc: kkhorimoto@chromium.org edchin@chromium.org marq@chromium.org rohitrao@chromium.org
cc. Rohit, Mark, and Ed.  I've run into this multiple times when hooking up coordinators' UI elements as FullscreenControllerObservers; we should move the logic to ChromeCoordinator so it doesn't have to be reimplemented in multiple places.  I can take this when I have some free cycles.

Sign in to add a comment