Commit 6f24b74e authored by stkhapugin's avatar stkhapugin Committed by Commit bot

Moves include of objc_property_releaser out of a header.

Moves include of ojbc_property_releaser to the implementation file to
allow this to be included from ARC code.
Also moves ivars to the implementation file, per style guide.

BUG=672510
TEST=None

Review-Url: https://codereview.chromium.org/2561133002
Cr-Commit-Position: refs/heads/master@{#437575}
parent fe1346fd
......@@ -7,10 +7,7 @@
#import <UIKit/UIKit.h>
#include "base/mac/objc_property_releaser.h"
#include "base/mac/scoped_nsobject.h"
#include "base/time/time.h"
#import "ios/chrome/browser/snapshots/lru_cache.h"
typedef void (^GreyBlock)(UIImage*);
......@@ -19,35 +16,7 @@ typedef void (^GreyBlock)(UIImage*);
// scroll offset and zoom level, used to stand in for the UIWebView if it has
// been purged from memory or when quickly switching tabs.
// Persists to disk on a background thread each time a snapshot changes.
@interface SnapshotCache : NSObject {
@private
// Dictionary to hold color snapshots in memory. n.b. Color snapshots are not
// kept in memory on tablets.
base::scoped_nsobject<NSMutableDictionary> imageDictionary_;
// Cache to hold color snapshots in memory. n.b. Color snapshots are not
// kept in memory on tablets. It is used in place of the imageDictionary_ when
// the LRU cache snapshot experiment is enabled.
base::scoped_nsobject<LRUCache> lruCache_;
// Temporary dictionary to hold grey snapshots for tablet side swipe. This
// will be nil before -createGreyCache is called and after -removeGreyCache
// is called.
base::scoped_nsobject<NSMutableDictionary> greyImageDictionary_;
NSSet* pinnedIDs_;
// Session ID of most recent pending grey snapshot request.
base::scoped_nsobject<NSString> mostRecentGreySessionId_;
// Block used by pending request for a grey snapshot.
base::scoped_nsprotocol<GreyBlock> mostRecentGreyBlock_;
// Session ID and correspoinding UIImage for the snapshot that will likely
// be requested to be saved to disk when the application is backgrounded.
base::scoped_nsobject<NSString> backgroundingImageSessionId_;
base::scoped_nsobject<UIImage> backgroundingColorImage_;
base::mac::ObjCPropertyReleaser propertyReleaser_SnapshotCache_;
}
@interface SnapshotCache : NSObject
// Track session IDs to not release on low memory and to reload on
// |UIApplicationDidBecomeActiveNotification|.
......
......@@ -13,11 +13,14 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/mac/bind_objc_block.h"
#include "base/mac/objc_property_releaser.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task_runner_util.h"
#include "base/threading/thread_restrictions.h"
#include "ios/chrome/browser/experimental_flags.h"
#import "ios/chrome/browser/snapshots/lru_cache.h"
#import "ios/chrome/browser/snapshots/snapshot_cache_internal.h"
#include "ios/chrome/browser/ui/ui_util.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
......@@ -129,7 +132,34 @@ void ConvertAndSaveGreyImage(
} // anonymous namespace
@implementation SnapshotCache
@implementation SnapshotCache {
// Dictionary to hold color snapshots in memory. n.b. Color snapshots are not
// kept in memory on tablets.
base::scoped_nsobject<NSMutableDictionary> imageDictionary_;
// Cache to hold color snapshots in memory. n.b. Color snapshots are not
// kept in memory on tablets. It is used in place of the imageDictionary_ when
// the LRU cache snapshot experiment is enabled.
base::scoped_nsobject<LRUCache> lruCache_;
// Temporary dictionary to hold grey snapshots for tablet side swipe. This
// will be nil before -createGreyCache is called and after -removeGreyCache
// is called.
base::scoped_nsobject<NSMutableDictionary> greyImageDictionary_;
NSSet* pinnedIDs_;
// Session ID of most recent pending grey snapshot request.
base::scoped_nsobject<NSString> mostRecentGreySessionId_;
// Block used by pending request for a grey snapshot.
base::scoped_nsprotocol<GreyBlock> mostRecentGreyBlock_;
// Session ID and correspoinding UIImage for the snapshot that will likely
// be requested to be saved to disk when the application is backgrounded.
base::scoped_nsobject<NSString> backgroundingImageSessionId_;
base::scoped_nsobject<UIImage> backgroundingColorImage_;
base::mac::ObjCPropertyReleaser propertyReleaser_SnapshotCache_;
}
@synthesize pinnedIDs = pinnedIDs_;
......
......@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/mac/bind_objc_block.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/mac/scoped_nsobject.h"
#include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/time/time.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment