OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ |
6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ | 6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #import "ios/chrome/browser/tabs/tab_model_observer.h" | 10 #import "ios/chrome/browser/tabs/tab_model_observer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 void clear() { | 22 void clear() { |
23 requestId = 0; | 23 requestId = 0; |
24 sessionId = 0; | 24 sessionId = 0; |
25 } | 25 } |
26 }; | 26 }; |
27 | 27 |
28 // A class that provides access to resized snapshots of tabs. The snapshots are | 28 // A class that provides access to resized snapshots of tabs. The snapshots are |
29 // cached and freed under memory pressure. | 29 // cached and freed under memory pressure. |
30 @interface TabSwitcherCache : NSObject<TabModelObserver> | 30 @interface TabSwitcherCache : NSObject<TabModelObserver> |
31 | 31 |
32 @property(nonatomic, readonly) TabModel* mainTabModel; | 32 @property(weak, nonatomic, readonly) TabModel* mainTabModel; |
33 | 33 |
34 // Request a snapshot for the given |tab| of the given |size|, |completionBlock| | 34 // Request a snapshot for the given |tab| of the given |size|, |completionBlock| |
35 // will be called with the requested snapshot. Must be called from the main | 35 // will be called with the requested snapshot. Must be called from the main |
36 // thread with a non nil |tab|, a non nil |completionBlock|, and a non | 36 // thread with a non nil |tab|, a non nil |completionBlock|, and a non |
37 // CGSizeZero |size|. | 37 // CGSizeZero |size|. |
38 // If the resized snapshot is cached, |completionBlock| is called synchronously. | 38 // If the resized snapshot is cached, |completionBlock| is called synchronously. |
39 // Otherwise it is called asynchronously on the main thread. The block's | 39 // Otherwise it is called asynchronously on the main thread. The block's |
40 // execution can be cancelled with |cancelPendingSnapshotRequest:|. | 40 // execution can be cancelled with |cancelPendingSnapshotRequest:|. |
41 // Requesting a snapshot for a given tab will cancel any previous request for | 41 // Requesting a snapshot for a given tab will cancel any previous request for |
42 // that same tab. The completion handler for a cancelled request may never be | 42 // that same tab. The completion handler for a cancelled request may never be |
(...skipping 12 matching lines...) Expand all Loading... |
55 // request matches |pendingRequest|. | 55 // request matches |pendingRequest|. |
56 - (void)cancelPendingSnapshotRequest:(PendingSnapshotRequest)pendingRequest; | 56 - (void)cancelPendingSnapshotRequest:(PendingSnapshotRequest)pendingRequest; |
57 | 57 |
58 // Sets the main and incognito tab models. | 58 // Sets the main and incognito tab models. |
59 - (void)setMainTabModel:(TabModel*)mainTabModel | 59 - (void)setMainTabModel:(TabModel*)mainTabModel |
60 otrTabModel:(TabModel*)otrTabModel; | 60 otrTabModel:(TabModel*)otrTabModel; |
61 | 61 |
62 @end | 62 @end |
63 | 63 |
64 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ | 64 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_CACHE_H_ |
OLD | NEW |