Index: ios/chrome/app/deferred_initialization_runner.h |
diff --git a/ios/chrome/app/deferred_initialization_runner.h b/ios/chrome/app/deferred_initialization_runner.h |
index e1bd59ce5e9006bb2fed80ffb1fd0202fc852000..1153e651bbe3aa3df8366544fadda091a1075f10 100644 |
--- a/ios/chrome/app/deferred_initialization_runner.h |
+++ b/ios/chrome/app/deferred_initialization_runner.h |
@@ -18,6 +18,7 @@ |
// Returns singleton instance. |
+ (DeferredInitializationRunner*)sharedInstance; |
+// Deprecated, use |enqueueBlockNamed:block:| instead. |
// Schedules |block| to be run after |delaySeconds| on the current queue. |
// This |block| is stored as |name| so code can force this initialization to |
// be run synchronously if necessary. This method may be called more than |
@@ -28,6 +29,16 @@ |
after:(NSTimeInterval)delaySeconds |
block:(ProceduralBlock)block; |
+// Adds |block| to a block queue containing all block not run. All blocks in the |
+// queue are run sequentially with a small delay between each block. |
+// If the queue is empty |block| is run after a small delay. |
sdefresne
2016/09/26 15:12:29
nit: I would remove this sentence as I found it co
gambard
2016/09/27 09:54:54
Nice rephrasing, thanks!
|
+// This |block| is stored as |name| so code can force this initialization to |
+// be run synchronously if necessary. This method may be called more than |
+// once with the same |name| parameter. Any block with the same |name| |
+// cancels a previously scheduled block of the same |name| if the block has |
+// not been run yet. |
+- (void)enqueueBlockNamed:(NSString*)name block:(ProceduralBlock)block; |
+ |
// Looks up a previously scheduled block of |name|. If block has not been |
// run yet, run it synchronously now. |
- (void)runBlockIfNecessary:(NSString*)name; |
@@ -42,4 +53,15 @@ |
@end |
+@interface DeferredInitializationRunner (ExposedForTesting) |
+ |
+// Time interval between two blocks. Default value is 200ms. |
+@property(nonatomic) NSTimeInterval delayBetweenBlocks; |
sdefresne
2016/09/26 15:12:29
@property(nonatomic, assign) ...
gambard
2016/09/27 09:54:54
Done.
|
+ |
+// Time interval before running the first block. To override default value of |
+// 3s, set this property before the first call to |-enqueueBlockNamed:block:|. |
+@property(nonatomic) NSTimeInterval delayBeforeFirstBlock; |
sdefresne
2016/09/26 15:12:29
@property(nonatomic, assign) ...
gambard
2016/09/27 09:54:54
Done.
|
+ |
+@end |
+ |
#endif // IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_ |