Chromium Code Reviews| Index: ios/chrome/browser/snapshots/snapshot_cache.mm |
| diff --git a/ios/chrome/browser/snapshots/snapshot_cache.mm b/ios/chrome/browser/snapshots/snapshot_cache.mm |
| index 49bbe14120d4adeef7f2d04d4f7b9089e8036df6..e6223e3759bc9c6feaf85d7ed6ff21898d7d794f 100644 |
| --- a/ios/chrome/browser/snapshots/snapshot_cache.mm |
| +++ b/ios/chrome/browser/snapshots/snapshot_cache.mm |
| @@ -7,7 +7,6 @@ |
| #import <UIKit/UIKit.h> |
| #include "base/critical_closure.h" |
| -#include "base/mac/bind_objc_block.h" |
| #include "base/files/file_enumerator.h" |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| @@ -206,14 +205,16 @@ void ConvertAndSaveGreyImage( |
| base::PostTaskAndReplyWithResult( |
| web::WebThread::GetMessageLoopProxyForThread( |
| web::WebThread::FILE_USER_BLOCKING).get(), |
| - FROM_HERE, |
| - base::BindBlock(^base::scoped_nsobject<UIImage>() { |
| + FROM_HERE, base::BindBlock(^base::scoped_nsobject<UIImage>() { |
| // Retrieve the image on a high priority thread. |
| return base::scoped_nsobject<UIImage>([ReadImageFromDisk( |
| [SnapshotCache imagePathForSessionID:sessionID]) retain]); |
| }), |
| base::BindBlock(^(base::scoped_nsobject<UIImage> image) { |
| - if (image) |
| + // The iPad tab switcher is currently using its own memory cache so the |
| + // image is not stored in memory here if running on iPad. |
| + // The same logic is used on image writes (code below). |
| + if (!IsIPadIdiom() && image) |
| [imageDictionary_ setObject:image forKey:sessionID]; |
| if (callback) |
| callback(image); |
|
noyau (Ping after 24h)
2015/05/19 21:36:34
Why would we retrieve the image if the callback is
sdefresne
2015/05/20 13:15:12
Changed the method to be a no-op on iPad if there
|
| @@ -225,7 +226,9 @@ void ConvertAndSaveGreyImage( |
| if (!img || !sessionID) |
| return; |
| - // Color snapshots are not used on tablets, so don't keep them in memory. |
| + // The iPad tab switcher is currently using its own memory cache so the image |
| + // is not stored in memory here if running on iPad. |
| + // The same logic is used on image reads (code above). |
| if (!IsIPadIdiom()) { |
| [imageDictionary_ setObject:img forKey:sessionID]; |
| } |