Chromium Code Reviews| Index: components/favicon/core/large_icon_service.h |
| diff --git a/components/favicon/core/large_icon_service.h b/components/favicon/core/large_icon_service.h |
| index bb8c1381f01ceaff4f7ece32adfbef69066f6056..042348acd8fe3199a84d6ea1e805749ad93f3792 100644 |
| --- a/components/favicon/core/large_icon_service.h |
| +++ b/components/favicon/core/large_icon_service.h |
| @@ -7,12 +7,18 @@ |
| #include <vector> |
| +#include "base/memory/ref_counted.h" |
| #include "base/task/cancelable_task_tracker.h" |
| +#include "base/threading/thread_checker.h" |
| #include "components/favicon_base/favicon_callback.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| class GURL; |
| +namespace base { |
| +class TaskRunner; |
| +} |
| + |
| namespace favicon_base { |
| struct FaviconRawBitmapResult; |
| } |
| @@ -50,14 +56,25 @@ class LargeIconService : public KeyedService { |
| const favicon_base::FaviconRawBitmapResult& bitmap_result, |
| favicon_base::FaviconRawBitmapResult* resized_bitmap_result); |
| - // Intermediate callback for GetLargeIconOrFallbackStyle(). Tries to resize |
| - // |bitmap_result| and pass the output to |callback|. If that does not work, |
| - // computes the icon fallback style and uses it to invoke |callback|. |
| + // Tries to resize |bitmap_result| and pass the output to |callback|. If that |
| + // does not work, computes the icon fallback style and uses it to invoke |
| + // |callback|. The work is done on a background thread since image resizing |
| + // can be expensive, and should not occur on the UI thread. |
| + void RunLargeIconCallbackOnBackgroundThread( |
| + const favicon_base::LargeIconCallback& callback, |
| + int desired_size_in_pixel, |
| + const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| + |
| + // Intermediate callback for GetLargeIconOrFallbackStyle(). |
|
beaudoin
2015/05/05 00:00:52
// Meant to be invoked on the UI thread, this shou
huangs
2015/05/05 15:22:13
Done.
|
| void RunLargeIconCallback( |
| const favicon_base::LargeIconCallback& callback, |
| int desired_size_in_pixel, |
| + base::CancelableTaskTracker* tracker, |
| const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| + // Return the TaskRunner used to execute background task. |
| + scoped_refptr<base::TaskRunner> GetBackgroundTaskRunner(); |
| + |
| FaviconService* favicon_service_; |
| // A pre-populated list of the types of icon files to consider when looking |
| @@ -65,6 +82,8 @@ class LargeIconService : public KeyedService { |
| // vector on each request. |
| std::vector<int> large_icon_types_; |
| + base::ThreadChecker thread_checker_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(LargeIconService); |
| }; |