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

Unified Diff: ios/chrome/browser/ui/util/label_observer.h

Issue 2828743002: LabelObserver is no longer retained by the label (Closed)
Patch Set: Address comments 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 | « ios/chrome/browser/ui/util/label_link_controller.mm ('k') | ios/chrome/browser/ui/util/label_observer.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/util/label_observer.h
diff --git a/ios/chrome/browser/ui/util/label_observer.h b/ios/chrome/browser/ui/util/label_observer.h
index f102efbd012807f71646bde9815bf505ea59b726..198c620caddc9afbd2b50c3e8c550cc7382fb507 100644
--- a/ios/chrome/browser/ui/util/label_observer.h
+++ b/ios/chrome/browser/ui/util/label_observer.h
@@ -16,13 +16,21 @@
@interface LabelObserver : NSObject
// Returns the LabelObserver for |label|, laziliy instantiating one if
-// necessary. LabelObservers are associated with the label, and will be
-// deallocated upon |label|'s deallocation.
+// necessary. LabelObservers are associated with label but must be kept alive by
+// the caller. |-startObserving| must be called before the |label| is observed.
+ (instancetype)observerForLabel:(UILabel*)label;
// LabelObservers should be created via |+observerForLabel:|.
- (instancetype)init NS_UNAVAILABLE;
+// Starts observing the label. For each call to this function, |-stopObserving|
+// should be called before |label| is deallocated.
+- (void)startObserving;
+
+// Stops observing the label. The label stop being observed once the number of
+// call to this function match the number of call to |-startObserving|.
+- (void)stopObserving;
+
// Block type that takes a label. Blocks registered for a label will be called
// when property values are updated.
typedef void (^LabelObserverAction)(UILabel* label);
« no previous file with comments | « ios/chrome/browser/ui/util/label_link_controller.mm ('k') | ios/chrome/browser/ui/util/label_observer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698