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

Side by Side 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: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
6 #define IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/ios/block_types.h"
11
12 // A singleton object to run initialization code asynchronously. Blocks are
13 // scheduled to be run after a delay. The block is named when added to the
14 // singleton so that other code can force a deferred block to be run
15 // synchronously if necessary.
16 @interface DeferredInitializationRunner : NSObject
17
18 // Returns singleton instance.
19 + (DeferredInitializationRunner*)sharedInstance;
20
21 // Schedules |block| to be run after |delaySeconds| on the current queue.
22 // This |block| is stored as |name| so code can force this initialization to
23 // be run synchronously if necessary. This method may be called more than
24 // once with the same |name| parameter. Any block with the same |name|
25 // cancels a previously scheduled block of the same |name| if the block has
26 // not been run yet.
27 - (void)runBlockNamed:(NSString*)name
28 after:(NSTimeInterval)delaySeconds
29 block:(ProceduralBlock)block;
30
31 // Looks up a previously scheduled block of |name|. If block has not been
32 // run yet, run it synchronously now.
33 - (void)runBlockIfNecessary:(NSString*)name;
34
35 // Cancels a previously scheduled block of |name|. This is a no-op if the
36 // block has already been executed.
37 - (void)cancelBlockNamed:(NSString*)name;
38
39 @end
40
41 #endif // IOS_CHROME_APP_DEFERRED_INITIALIZATION_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698