Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 // static | 334 // static |
| 335 jint GetNativeInstanceCount(JNIEnv* env, jclass) { | 335 jint GetNativeInstanceCount(JNIEnv* env, jclass) { |
| 336 return base::subtle::NoBarrier_Load(&g_instance_count); | 336 return base::subtle::NoBarrier_Load(&g_instance_count); |
| 337 } | 337 } |
| 338 | 338 |
| 339 jlong AwContents::GetAwDrawGLViewContext(JNIEnv* env, jobject obj) { | 339 jlong AwContents::GetAwDrawGLViewContext(JNIEnv* env, jobject obj) { |
| 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 341 return reinterpret_cast<intptr_t>(this); | 341 return reinterpret_cast<intptr_t>(this); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void AwContents::DrawGLForTesting(JNIEnv* env, | |
| 345 jobject obj, | |
| 346 jint width, | |
| 347 jint height) { | |
| 348 AwDrawGLInfo draw_info; | |
| 349 draw_info.mode = AwDrawGLInfo::kModeDraw; | |
|
no sievers
2014/07/22 20:53:18
So I think since the SurfaceView never moves (when
| |
| 350 draw_info.is_layer = true; | |
| 351 draw_info.width = width; | |
| 352 draw_info.height = height; | |
| 353 draw_info.clip_left = 0; | |
| 354 draw_info.clip_top = 0; | |
| 355 draw_info.clip_bottom = height; | |
| 356 draw_info.clip_right = width; | |
| 357 draw_info.transform[0] = 1.0; | |
| 358 draw_info.transform[1] = 0.0; | |
| 359 draw_info.transform[2] = 0.0; | |
| 360 draw_info.transform[3] = 0.0; | |
| 361 | |
| 362 draw_info.transform[4] = 0.0; | |
| 363 draw_info.transform[5] = 1.0; | |
| 364 draw_info.transform[6] = 0.0; | |
| 365 draw_info.transform[7] = 0.0; | |
| 366 | |
| 367 draw_info.transform[8] = 0.0; | |
| 368 draw_info.transform[9] = 0.0; | |
| 369 draw_info.transform[10] = 1.0; | |
| 370 draw_info.transform[11] = 0.0; | |
| 371 | |
| 372 draw_info.transform[12] = 0.0; | |
| 373 draw_info.transform[13] = 0.0; | |
| 374 draw_info.transform[14] = 0.0; | |
| 375 draw_info.transform[15] = 1.0; | |
| 376 DrawGL(&draw_info); | |
| 377 } | |
| 378 | |
| 344 void AwContents::DrawGL(AwDrawGLInfo* draw_info) { | 379 void AwContents::DrawGL(AwDrawGLInfo* draw_info) { |
| 345 { | 380 { |
| 346 GLViewRendererManager* manager = GLViewRendererManager::GetInstance(); | 381 GLViewRendererManager* manager = GLViewRendererManager::GetInstance(); |
| 347 base::AutoLock lock(render_thread_lock_); | 382 base::AutoLock lock(render_thread_lock_); |
| 348 if (renderer_manager_key_ != manager->NullKey()) { | 383 if (renderer_manager_key_ != manager->NullKey()) { |
| 349 manager->DidDrawGL(renderer_manager_key_); | 384 manager->DidDrawGL(renderer_manager_key_); |
| 350 } | 385 } |
| 351 } | 386 } |
| 352 | 387 |
| 353 ScopedAppGLStateRestore state_restore( | 388 ScopedAppGLStateRestore state_restore( |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 840 } | 875 } |
| 841 } | 876 } |
| 842 } | 877 } |
| 843 | 878 |
| 844 void AwContents::OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h) { | 879 void AwContents::OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h) { |
| 845 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 880 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 846 browser_view_renderer_.OnAttachedToWindow(w, h); | 881 browser_view_renderer_.OnAttachedToWindow(w, h); |
| 847 } | 882 } |
| 848 | 883 |
| 849 void AwContents::InitializeHardwareDrawIfNeeded() { | 884 void AwContents::InitializeHardwareDrawIfNeeded() { |
| 885 LOG(INFO) << "AwContents::InitializeHardwareDrawIfNeeded"; | |
| 850 GLViewRendererManager* manager = GLViewRendererManager::GetInstance(); | 886 GLViewRendererManager* manager = GLViewRendererManager::GetInstance(); |
| 851 | 887 |
| 852 base::AutoLock lock(render_thread_lock_); | 888 base::AutoLock lock(render_thread_lock_); |
| 853 if (renderer_manager_key_ == manager->NullKey()) { | 889 if (renderer_manager_key_ == manager->NullKey()) { |
| 854 renderer_manager_key_ = manager->PushBack(&shared_renderer_state_); | 890 renderer_manager_key_ = manager->PushBack(&shared_renderer_state_); |
| 855 DeferredGpuCommandService::SetInstance(); | 891 DeferredGpuCommandService::SetInstance(); |
| 856 } | 892 } |
| 857 } | 893 } |
| 858 | 894 |
| 859 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) { | 895 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1144 } | 1180 } |
| 1145 | 1181 |
| 1146 browser_view_renderer_.TrimMemory(level, visible); | 1182 browser_view_renderer_.TrimMemory(level, visible); |
| 1147 } | 1183 } |
| 1148 | 1184 |
| 1149 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1185 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1150 g_should_download_favicons = true; | 1186 g_should_download_favicons = true; |
| 1151 } | 1187 } |
| 1152 | 1188 |
| 1153 } // namespace android_webview | 1189 } // namespace android_webview |
| OLD | NEW |