| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ | 6 #define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "chrome/browser/android/thumbnail/scoped_ptr_expiring_cache.h" | 18 #include "chrome/browser/android/thumbnail/scoped_ptr_expiring_cache.h" |
| 19 #include "chrome/browser/android/thumbnail/thumbnail.h" | 19 #include "chrome/browser/android/thumbnail/thumbnail.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "ui/android/resources/ui_resource_client_android.h" | |
| 22 #include "ui/android/resources/ui_resource_provider.h" | 21 #include "ui/android/resources/ui_resource_provider.h" |
| 23 #include "ui/gfx/geometry/point.h" | 22 #include "ui/gfx/geometry/point.h" |
| 24 #include "ui/gfx/geometry/size.h" | 23 #include "ui/gfx/geometry/size.h" |
| 25 #include "ui/gfx/geometry/size_f.h" | 24 #include "ui/gfx/geometry/size_f.h" |
| 26 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 27 | 26 |
| 28 namespace base { | 27 namespace base { |
| 29 class File; | 28 class File; |
| 30 class Time; | 29 class Time; |
| 31 } | 30 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 62 |
| 64 void RemoveFromDiskAtAndAboveId(TabId min_id); | 63 void RemoveFromDiskAtAndAboveId(TabId min_id); |
| 65 void InvalidateThumbnailIfChanged(TabId tab_id, const GURL& url); | 64 void InvalidateThumbnailIfChanged(TabId tab_id, const GURL& url); |
| 66 bool CheckAndUpdateThumbnailMetaData(TabId tab_id, const GURL& url); | 65 bool CheckAndUpdateThumbnailMetaData(TabId tab_id, const GURL& url); |
| 67 void UpdateVisibleIds(const TabIdList& priority); | 66 void UpdateVisibleIds(const TabIdList& priority); |
| 68 void DecompressThumbnailFromFile( | 67 void DecompressThumbnailFromFile( |
| 69 TabId tab_id, | 68 TabId tab_id, |
| 70 const base::Callback<void(bool, SkBitmap)>& | 69 const base::Callback<void(bool, SkBitmap)>& |
| 71 post_decompress_callback); | 70 post_decompress_callback); |
| 72 | 71 |
| 72 // Called when resident textures were evicted, which requires paging |
| 73 // in bitmaps. |
| 74 void OnUIResourcesWereEvicted(); |
| 75 |
| 73 // ThumbnailDelegate implementation | 76 // ThumbnailDelegate implementation |
| 74 void InvalidateCachedThumbnail(Thumbnail* thumbnail) override; | 77 void InvalidateCachedThumbnail(Thumbnail* thumbnail) override; |
| 75 static base::FilePath GetCacheDirectory(); | 78 static base::FilePath GetCacheDirectory(); |
| 76 static base::FilePath GetFilePath(TabId tab_id); | 79 static base::FilePath GetFilePath(TabId tab_id); |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 class ThumbnailMetaData { | 82 class ThumbnailMetaData { |
| 80 public: | 83 public: |
| 81 ThumbnailMetaData(); | 84 ThumbnailMetaData(); |
| 82 ThumbnailMetaData(const base::Time& current_time, const GURL& url); | 85 ThumbnailMetaData(const base::Time& current_time, const GURL& url); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 TabIdList visible_ids_; | 161 TabIdList visible_ids_; |
| 159 | 162 |
| 160 ui::UIResourceProvider* ui_resource_provider_; | 163 ui::UIResourceProvider* ui_resource_provider_; |
| 161 | 164 |
| 162 base::WeakPtrFactory<ThumbnailCache> weak_factory_; | 165 base::WeakPtrFactory<ThumbnailCache> weak_factory_; |
| 163 | 166 |
| 164 DISALLOW_COPY_AND_ASSIGN(ThumbnailCache); | 167 DISALLOW_COPY_AND_ASSIGN(ThumbnailCache); |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 #endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ | 170 #endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_CACHE_H_ |
| OLD | NEW |