Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/android/compositor/tab_content_manager.cc

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 content::ContentViewCore* view = 64 content::ContentViewCore* view =
65 content::ContentViewCore::GetNativeContentViewCore( 65 content::ContentViewCore::GetNativeContentViewCore(
66 env, j_content_view_core_.obj()); 66 env, j_content_view_core_.obj());
67 67
68 if (!view) { 68 if (!view) {
69 result_callback.Run(SkBitmap(), content::READBACK_FAILED); 69 result_callback.Run(SkBitmap(), content::READBACK_FAILED);
70 return; 70 return;
71 } 71 }
72 72
73 #if defined(OS_ANDROID) && !defined(USE_AURA)
73 DCHECK(view->GetWebContents()); 74 DCHECK(view->GetWebContents());
74 view->GetWebContents()->GetRenderViewHost()->LockBackingStore(); 75 view->GetWebContents()->GetRenderViewHost()->LockBackingStore();
76 #endif
75 77
76 SkColorType color_type = kN32_SkColorType; 78 SkColorType color_type = kN32_SkColorType;
77 79
78 // Calling this method with an empty rect will return a bitmap of the size 80 // Calling this method with an empty rect will return a bitmap of the size
79 // of the content. 81 // of the content.
80 view->GetScaledContentBitmap(thumbnail_scale_, color_type, gfx::Rect(), 82 view->GetScaledContentBitmap(thumbnail_scale_, color_type, gfx::Rect(),
81 result_callback); 83 result_callback);
82 } 84 }
83 85
84 void OnFinishGetTabThumbnailBitmap(const SkBitmap& bitmap, 86 void OnFinishGetTabThumbnailBitmap(const SkBitmap& bitmap,
85 content::ReadbackResponse response) { 87 content::ReadbackResponse response) {
86 DCHECK(!j_content_view_core_.is_null()); 88 DCHECK(!j_content_view_core_.is_null());
89 #if defined(OS_ANDROID) && !defined(USE_AURA)
87 JNIEnv* env = base::android::AttachCurrentThread(); 90 JNIEnv* env = base::android::AttachCurrentThread();
88 content::ContentViewCore* view = 91 content::ContentViewCore* view =
89 content::ContentViewCore::GetNativeContentViewCore( 92 content::ContentViewCore::GetNativeContentViewCore(
90 env, j_content_view_core_.obj()); 93 env, j_content_view_core_.obj());
91 94
92 if (view) { 95 if (view) {
93 DCHECK(view->GetWebContents()); 96 DCHECK(view->GetWebContents());
94 view->GetWebContents()->GetRenderViewHost()->UnlockBackingStore(); 97 view->GetWebContents()->GetRenderViewHost()->UnlockBackingStore();
95 } 98 }
99 #endif
96 100
97 // TODO(jdduke): Tailor response to different failure values appropriately. 101 // TODO(jdduke): Tailor response to different failure values appropriately.
98 if (response != content::READBACK_SUCCESS || drop_after_readback_) { 102 if (response != content::READBACK_SUCCESS || drop_after_readback_) {
99 end_callback_.Run(0.f, SkBitmap()); 103 end_callback_.Run(0.f, SkBitmap());
100 return; 104 return;
101 } 105 }
102 106
103 SkBitmap result_bitmap = bitmap; 107 SkBitmap result_bitmap = bitmap;
104 result_bitmap.setImmutable(); 108 result_bitmap.setImmutable();
105 end_callback_.Run(thumbnail_scale_, bitmap); 109 end_callback_.Run(thumbnail_scale_, bitmap);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 jboolean use_approximation_thumbnail) { 382 jboolean use_approximation_thumbnail) {
379 TabContentManager* manager = new TabContentManager( 383 TabContentManager* manager = new TabContentManager(
380 env, obj, default_cache_size, approximation_cache_size, 384 env, obj, default_cache_size, approximation_cache_size,
381 compression_queue_max_size, write_queue_max_size, 385 compression_queue_max_size, write_queue_max_size,
382 use_approximation_thumbnail); 386 use_approximation_thumbnail);
383 return reinterpret_cast<intptr_t>(manager); 387 return reinterpret_cast<intptr_t>(manager);
384 } 388 }
385 389
386 } // namespace android 390 } // namespace android
387 } // namespace chrome 391 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698