| 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/compositor/tab_content_manager.h" | 5 #include "chrome/browser/android/compositor/tab_content_manager.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 std::list<int> priority_ids; | 283 std::list<int> priority_ids; |
| 284 jsize length = env->GetArrayLength(priority); | 284 jsize length = env->GetArrayLength(priority); |
| 285 jint* ints = env->GetIntArrayElements(priority, nullptr); | 285 jint* ints = env->GetIntArrayElements(priority, nullptr); |
| 286 for (jsize i = 0; i < length; ++i) | 286 for (jsize i = 0; i < length; ++i) |
| 287 priority_ids.push_back(static_cast<int>(ints[i])); | 287 priority_ids.push_back(static_cast<int>(ints[i])); |
| 288 | 288 |
| 289 env->ReleaseIntArrayElements(priority, ints, JNI_ABORT); | 289 env->ReleaseIntArrayElements(priority, ints, JNI_ABORT); |
| 290 thumbnail_cache_->UpdateVisibleIds(priority_ids, primary_tab_id); | 290 thumbnail_cache_->UpdateVisibleIds(priority_ids, primary_tab_id); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void TabContentManager::RemoveTabThumbnail(JNIEnv* env, | 293 void TabContentManager::NativeRemoveTabThumbnail(int tab_id) { |
| 294 const JavaParamRef<jobject>& obj, | |
| 295 jint tab_id) { | |
| 296 TabReadbackRequestMap::iterator readback_iter = | 294 TabReadbackRequestMap::iterator readback_iter = |
| 297 pending_tab_readbacks_.find(tab_id); | 295 pending_tab_readbacks_.find(tab_id); |
| 298 if (readback_iter != pending_tab_readbacks_.end()) | 296 if (readback_iter != pending_tab_readbacks_.end()) |
| 299 readback_iter->second->SetToDropAfterReadback(); | 297 readback_iter->second->SetToDropAfterReadback(); |
| 300 thumbnail_cache_->Remove(tab_id); | 298 thumbnail_cache_->Remove(tab_id); |
| 301 } | 299 } |
| 302 | 300 |
| 301 void TabContentManager::RemoveTabThumbnail(JNIEnv* env, |
| 302 const JavaParamRef<jobject>& obj, |
| 303 jint tab_id) { |
| 304 NativeRemoveTabThumbnail(tab_id); |
| 305 } |
| 306 |
| 303 void TabContentManager::GetDecompressedThumbnail( | 307 void TabContentManager::GetDecompressedThumbnail( |
| 304 JNIEnv* env, | 308 JNIEnv* env, |
| 305 const JavaParamRef<jobject>& obj, | 309 const JavaParamRef<jobject>& obj, |
| 306 jint tab_id) { | 310 jint tab_id) { |
| 307 base::Callback<void(bool, SkBitmap)> decompress_done_callback = | 311 base::Callback<void(bool, SkBitmap)> decompress_done_callback = |
| 308 base::Bind(&TabContentManager::OnFinishDecompressThumbnail, | 312 base::Bind(&TabContentManager::OnFinishDecompressThumbnail, |
| 309 weak_factory_.GetWeakPtr(), reinterpret_cast<int>(tab_id)); | 313 weak_factory_.GetWeakPtr(), reinterpret_cast<int>(tab_id)); |
| 310 thumbnail_cache_->DecompressThumbnailFromFile(reinterpret_cast<int>(tab_id), | 314 thumbnail_cache_->DecompressThumbnailFromFile(reinterpret_cast<int>(tab_id), |
| 311 decompress_done_callback); | 315 decompress_done_callback); |
| 312 } | 316 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 jint write_queue_max_size, | 354 jint write_queue_max_size, |
| 351 jboolean use_approximation_thumbnail) { | 355 jboolean use_approximation_thumbnail) { |
| 352 TabContentManager* manager = new TabContentManager( | 356 TabContentManager* manager = new TabContentManager( |
| 353 env, obj, default_cache_size, approximation_cache_size, | 357 env, obj, default_cache_size, approximation_cache_size, |
| 354 compression_queue_max_size, write_queue_max_size, | 358 compression_queue_max_size, write_queue_max_size, |
| 355 use_approximation_thumbnail); | 359 use_approximation_thumbnail); |
| 356 return reinterpret_cast<intptr_t>(manager); | 360 return reinterpret_cast<intptr_t>(manager); |
| 357 } | 361 } |
| 358 | 362 |
| 359 } // namespace android | 363 } // namespace android |
| OLD | NEW |