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

Unified Diff: ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h

Issue 2811973004: No-op when starting a started coordinator (ditto for stop). (Closed)
Patch Set: Update doc Created 3 years, 8 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 | ios/shared/chrome/browser/ui/coordinators/browser_coordinator.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h
diff --git a/ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h b/ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h
index 1386b19fb11c53156db65e1e5a700f4a1db2903c..4102a3c74b45b18ab3adc4e261eb59ddfa2d3e05 100644
--- a/ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h
+++ b/ios/shared/chrome/browser/ui/coordinators/browser_coordinator.h
@@ -22,19 +22,32 @@ class Browser;
@property(nonatomic, assign) Browser* browser;
// The basic lifecycle methods for coordinators are -start and -stop. These
-// implementations only notify the parent coordinator when this coordinator did
-// start and will stop. Child classes are expected to override and call the
-// superclass method at the end of -start and at the beginning of -stop.
+// implementations notify the parent coordinator when this coordinator did start
+// and will stop. Child classes are expected to override and call the superclass
+// method at the end of -start and at the beginning of -stop.
+// If the receiver is already started, -start is a no-op. If the receiver is
+// already stopped or never started, -stop is a no-op. In those cases, the
+// overriding implementations can early return withotu calling the superclass
+// method:
+// SubCoordinator.mm:
+// - (void)start {
+// if (self.started) return;
+// ...
+// [super start];
+// }
// Starts the user interaction managed by the receiver. Typical implementations
// will create a view controller and then use |baseViewController| to present
// it. This method needs to be called at the end of the overriding
// implementation.
+// Starting a started coordinator is a no-op in this implementation.
- (void)start NS_REQUIRES_SUPER;
// Stops the user interaction managed by the receiver. This method needs to be
// called at the beginning of the overriding implementation.
// Calling stop on a coordinator transitively calls stop on its children.
+// Stopping a non-started or stopped coordinator is a no-op in this
+// implementation.
- (void)stop NS_REQUIRES_SUPER;
@end
« no previous file with comments | « no previous file | ios/shared/chrome/browser/ui/coordinators/browser_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698