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

Unified Diff: ios/chrome/app/deferred_initialization_runner.h

Issue 1110133002: [iOS] Upstream code in //ios/chrome/app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 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/app/UIApplication+ExitsOnSuspend.mm ('k') | ios/chrome/app/deferred_initialization_runner.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..11b9c92385663228af236b5546b847a5f9e83f9d
--- /dev/null
+++ b/ios/chrome/app/deferred_initialization_runner.h
@@ -0,0 +1,41 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
+#define IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
+
+#import <Foundation/Foundation.h>
+
+#include "base/ios/block_types.h"
+
+// A singleton object to run initialization code asynchronously. Blocks are
+// scheduled to be run after a delay. The block is named when added to the
+// singleton so that other code can force a deferred block to be run
+// synchronously if necessary.
+@interface DeferredInitializationRunner : NSObject
+
+// Returns singleton instance.
++ (DeferredInitializationRunner*)sharedInstance;
+
+// 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
+// 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)runBlockNamed:(NSString*)name
+ after:(NSTimeInterval)delaySeconds
+ 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;
+
+// Cancels a previously scheduled block of |name|. This is a no-op if the
+// block has already been executed.
+- (void)cancelBlockNamed:(NSString*)name;
+
+@end
+
+#endif // IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
« no previous file with comments | « ios/chrome/app/UIApplication+ExitsOnSuspend.mm ('k') | ios/chrome/app/deferred_initialization_runner.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698