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 #include "chrome/browser/android/thumbnail/thumbnail_cache.h" | 5 #include "chrome/browser/android/thumbnail/thumbnail_cache.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 : disk_cache_path_(disk_cache_path_str), | 120 : disk_cache_path_(disk_cache_path_str), |
121 compression_queue_max_size_(compression_queue_max_size), | 121 compression_queue_max_size_(compression_queue_max_size), |
122 write_queue_max_size_(write_queue_max_size), | 122 write_queue_max_size_(write_queue_max_size), |
123 use_approximation_thumbnail_(use_approximation_thumbnail), | 123 use_approximation_thumbnail_(use_approximation_thumbnail), |
124 compression_tasks_count_(0), | 124 compression_tasks_count_(0), |
125 write_tasks_count_(0), | 125 write_tasks_count_(0), |
126 read_in_progress_(false), | 126 read_in_progress_(false), |
127 cache_(default_cache_size), | 127 cache_(default_cache_size), |
128 approximation_cache_(approximation_cache_size), | 128 approximation_cache_(approximation_cache_size), |
129 ui_resource_provider_(NULL), | 129 ui_resource_provider_(NULL), |
130 weak_factory_(this) { | 130 weak_factory_(this) {} |
131 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
132 } | |
133 | 131 |
134 ThumbnailCache::~ThumbnailCache() { | 132 ThumbnailCache::~ThumbnailCache() { |
135 SetUIResourceProvider(NULL); | 133 SetUIResourceProvider(NULL); |
136 } | 134 } |
137 | 135 |
138 void ThumbnailCache::SetUIResourceProvider( | 136 void ThumbnailCache::SetUIResourceProvider( |
139 ui::UIResourceProvider* ui_resource_provider) { | 137 ui::UIResourceProvider* ui_resource_provider) { |
140 if (ui_resource_provider_ == ui_resource_provider) | 138 if (ui_resource_provider_ == ui_resource_provider) |
141 return; | 139 return; |
142 | 140 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 dst_bitmap.eraseColor(0); | 919 dst_bitmap.eraseColor(0); |
922 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); | 920 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); |
923 | 921 |
924 SkCanvas canvas(dst_bitmap); | 922 SkCanvas canvas(dst_bitmap); |
925 canvas.scale(new_scale, new_scale); | 923 canvas.scale(new_scale, new_scale); |
926 canvas.drawBitmap(bitmap, 0, 0, NULL); | 924 canvas.drawBitmap(bitmap, 0, 0, NULL); |
927 dst_bitmap.setImmutable(); | 925 dst_bitmap.setImmutable(); |
928 | 926 |
929 return std::make_pair(dst_bitmap, new_scale * scale); | 927 return std::make_pair(dst_bitmap, new_scale * scale); |
930 } | 928 } |
OLD | NEW |