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