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 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 JNIEnv* env = base::android::AttachCurrentThread(); | 87 JNIEnv* env = base::android::AttachCurrentThread(); |
88 content::ContentViewCore* view = | 88 content::ContentViewCore* view = |
89 content::ContentViewCore::GetNativeContentViewCore( | 89 content::ContentViewCore::GetNativeContentViewCore( |
90 env, j_content_view_core_.obj()); | 90 env, j_content_view_core_.obj()); |
91 | 91 |
92 if (view) { | 92 if (view) { |
93 DCHECK(view->GetWebContents()); | 93 DCHECK(view->GetWebContents()); |
94 view->GetWebContents()->GetRenderViewHost()->UnlockBackingStore(); | 94 view->GetWebContents()->GetRenderViewHost()->UnlockBackingStore(); |
95 } | 95 } |
96 | 96 |
97 // TODO(jdduke): Tailor response to different failure values appropriately. | |
98 if (response != content::READBACK_SUCCESS || drop_after_readback_) { | 97 if (response != content::READBACK_SUCCESS || drop_after_readback_) { |
99 end_callback_.Run(0.f, SkBitmap()); | 98 end_callback_.Run(0.f, SkBitmap()); |
100 return; | 99 return; |
101 } | 100 } |
102 | 101 |
103 SkBitmap result_bitmap = bitmap; | 102 SkBitmap result_bitmap = bitmap; |
104 result_bitmap.setImmutable(); | 103 result_bitmap.setImmutable(); |
105 end_callback_.Run(thumbnail_scale_, bitmap); | 104 end_callback_.Run(thumbnail_scale_, bitmap); |
106 } | 105 } |
107 | 106 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 jboolean use_approximation_thumbnail) { | 373 jboolean use_approximation_thumbnail) { |
375 TabContentManager* manager = new TabContentManager( | 374 TabContentManager* manager = new TabContentManager( |
376 env, obj, default_cache_size, approximation_cache_size, | 375 env, obj, default_cache_size, approximation_cache_size, |
377 compression_queue_max_size, write_queue_max_size, | 376 compression_queue_max_size, write_queue_max_size, |
378 use_approximation_thumbnail); | 377 use_approximation_thumbnail); |
379 return reinterpret_cast<intptr_t>(manager); | 378 return reinterpret_cast<intptr_t>(manager); |
380 } | 379 } |
381 | 380 |
382 } // namespace android | 381 } // namespace android |
383 } // namespace chrome | 382 } // namespace chrome |
OLD | NEW |