| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_APP_LIST_ICON_CACHE_H_ | 5 #ifndef UI_APP_LIST_ICON_CACHE_H_ |
| 6 #define UI_APP_LIST_ICON_CACHE_H_ | 6 #define UI_APP_LIST_ICON_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | |
| 13 #include "ui/app_list/app_list_export.h" | 12 #include "ui/app_list/app_list_export.h" |
| 13 #include "ui/gfx/image/image_skia.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Size; | 16 class Size; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace app_list { | 19 namespace app_list { |
| 20 | 20 |
| 21 // IconCache stores processed image, keyed by the source image and desired size. | 21 // IconCache stores processed image, keyed by the source image and desired size. |
| 22 class APP_LIST_EXPORT IconCache { | 22 class APP_LIST_EXPORT IconCache { |
| 23 public: | 23 public: |
| 24 static void CreateInstance(); | 24 static void CreateInstance(); |
| 25 static void DeleteInstance(); | 25 static void DeleteInstance(); |
| 26 | 26 |
| 27 static IconCache* GetInstance(); | 27 static IconCache* GetInstance(); |
| 28 | 28 |
| 29 void MarkAllEntryUnused(); | 29 void MarkAllEntryUnused(); |
| 30 void PurgeAllUnused(); | 30 void PurgeAllUnused(); |
| 31 | 31 |
| 32 bool Get(const SkBitmap& src, | 32 bool Get(const gfx::ImageSkia& src, |
| 33 const gfx::Size& size, | 33 const gfx::Size& size, |
| 34 SkBitmap* processed); | 34 gfx::ImageSkia* processed); |
| 35 void Put(const SkBitmap& src, | 35 void Put(const gfx::ImageSkia& src, |
| 36 const gfx::Size& size, | 36 const gfx::Size& size, |
| 37 const SkBitmap& processed); | 37 const gfx::ImageSkia& processed); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 struct Item { | 40 struct Item { |
| 41 SkBitmap image; | 41 gfx::ImageSkia image; |
| 42 bool used; | 42 bool used; |
| 43 }; | 43 }; |
| 44 typedef std::map<std::string, Item> Cache; | 44 typedef std::map<std::string, Item> Cache; |
| 45 | 45 |
| 46 IconCache(); | 46 IconCache(); |
| 47 ~IconCache(); | 47 ~IconCache(); |
| 48 | 48 |
| 49 static IconCache* instance_; | 49 static IconCache* instance_; |
| 50 | 50 |
| 51 Cache cache_; | 51 Cache cache_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(IconCache); | 53 DISALLOW_COPY_AND_ASSIGN(IconCache); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace app_list | 56 } // namespace app_list |
| 57 | 57 |
| 58 #endif // UI_APP_LIST_ICON_CACHE_H_ | 58 #endif // UI_APP_LIST_ICON_CACHE_H_ |
| OLD | NEW |