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 #include <utility> |
9 | 10 |
10 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
11 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
12 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
17 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" | 18 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" |
18 #include "chrome/browser/android/tab_android.h" | 19 #include "chrome/browser/android/tab_android.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 thumbnail_cache_->Remove(tab_id); | 267 thumbnail_cache_->Remove(tab_id); |
267 return; | 268 return; |
268 } | 269 } |
269 | 270 |
270 TabReadbackCallback readback_done_callback = | 271 TabReadbackCallback readback_done_callback = |
271 base::Bind(&TabContentManager::PutThumbnailIntoCache, | 272 base::Bind(&TabContentManager::PutThumbnailIntoCache, |
272 weak_factory_.GetWeakPtr(), tab_id); | 273 weak_factory_.GetWeakPtr(), tab_id); |
273 scoped_ptr<TabReadbackRequest> readback_request = | 274 scoped_ptr<TabReadbackRequest> readback_request = |
274 make_scoped_ptr(new TabReadbackRequest( | 275 make_scoped_ptr(new TabReadbackRequest( |
275 content_view_core, thumbnail_scale, readback_done_callback)); | 276 content_view_core, thumbnail_scale, readback_done_callback)); |
276 pending_tab_readbacks_.set(tab_id, readback_request.Pass()); | 277 pending_tab_readbacks_.set(tab_id, std::move(readback_request)); |
277 pending_tab_readbacks_.get(tab_id)->Run(); | 278 pending_tab_readbacks_.get(tab_id)->Run(); |
278 } | 279 } |
279 } | 280 } |
280 | 281 |
281 void TabContentManager::CacheTabWithBitmap(JNIEnv* env, | 282 void TabContentManager::CacheTabWithBitmap(JNIEnv* env, |
282 const JavaParamRef<jobject>& obj, | 283 const JavaParamRef<jobject>& obj, |
283 const JavaParamRef<jobject>& tab, | 284 const JavaParamRef<jobject>& tab, |
284 const JavaParamRef<jobject>& bitmap, | 285 const JavaParamRef<jobject>& bitmap, |
285 jfloat thumbnail_scale) { | 286 jfloat thumbnail_scale) { |
286 TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); | 287 TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 jboolean use_approximation_thumbnail) { | 387 jboolean use_approximation_thumbnail) { |
387 TabContentManager* manager = new TabContentManager( | 388 TabContentManager* manager = new TabContentManager( |
388 env, obj, default_cache_size, approximation_cache_size, | 389 env, obj, default_cache_size, approximation_cache_size, |
389 compression_queue_max_size, write_queue_max_size, | 390 compression_queue_max_size, write_queue_max_size, |
390 use_approximation_thumbnail); | 391 use_approximation_thumbnail); |
391 return reinterpret_cast<intptr_t>(manager); | 392 return reinterpret_cast<intptr_t>(manager); |
392 } | 393 } |
393 | 394 |
394 } // namespace android | 395 } // namespace android |
395 } // namespace chrome | 396 } // namespace chrome |
OLD | NEW |