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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 manager->DidDrawGL(renderer_manager_key_); | 355 manager->DidDrawGL(renderer_manager_key_); |
356 } | 356 } |
357 } | 357 } |
358 | 358 |
359 ScopedAppGLStateRestore state_restore( | 359 ScopedAppGLStateRestore state_restore( |
360 draw_info->mode == AwDrawGLInfo::kModeDraw | 360 draw_info->mode == AwDrawGLInfo::kModeDraw |
361 ? ScopedAppGLStateRestore::MODE_DRAW | 361 ? ScopedAppGLStateRestore::MODE_DRAW |
362 : ScopedAppGLStateRestore::MODE_RESOURCE_MANAGEMENT); | 362 : ScopedAppGLStateRestore::MODE_RESOURCE_MANAGEMENT); |
363 ScopedAllowGL allow_gl; | 363 ScopedAllowGL allow_gl; |
364 | 364 |
| 365 if (draw_info->mode == AwDrawGLInfo::kModeProcessNoContext) { |
| 366 LOG(ERROR) << "Received unexpected kModeProcessNoContext"; |
| 367 } |
| 368 |
| 369 // kModeProcessNoContext should never happen because we tear down hardware |
| 370 // in onTrimMemory. However that guarantee is maintained outside of chromium |
| 371 // code. Not notifying shared state in kModeProcessNoContext can lead to |
| 372 // immediate deadlock, which is slightly more catastrophic than leaks or |
| 373 // corruption. |
| 374 if (draw_info->mode == AwDrawGLInfo::kModeProcess || |
| 375 draw_info->mode == AwDrawGLInfo::kModeProcessNoContext) { |
| 376 shared_renderer_state_.DidDrawGLProcess(); |
| 377 } |
| 378 |
365 if (shared_renderer_state_.IsInsideHardwareRelease()) { | 379 if (shared_renderer_state_.IsInsideHardwareRelease()) { |
366 hardware_renderer_.reset(); | 380 hardware_renderer_.reset(); |
367 // Flush the idle queue in tear down. | 381 // Flush the idle queue in tear down. |
368 DeferredGpuCommandService::GetInstance()->PerformIdleWork(true); | 382 DeferredGpuCommandService::GetInstance()->PerformAllIdleWork(); |
369 DCHECK(!DeferredGpuCommandService::GetInstance()->HasIdleWork()); | |
370 return; | 383 return; |
371 } | 384 } |
372 | 385 |
373 if (draw_info->mode != AwDrawGLInfo::kModeDraw) { | 386 if (draw_info->mode != AwDrawGLInfo::kModeDraw) { |
374 if (draw_info->mode == AwDrawGLInfo::kModeProcess) { | 387 if (draw_info->mode == AwDrawGLInfo::kModeProcess) { |
375 DeferredGpuCommandService::GetInstance()->PerformIdleWork(true); | 388 DeferredGpuCommandService::GetInstance()->PerformIdleWork(true); |
376 } | 389 } |
377 return; | 390 return; |
378 } | 391 } |
379 | 392 |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 } | 1177 } |
1165 | 1178 |
1166 browser_view_renderer_.TrimMemory(level, visible); | 1179 browser_view_renderer_.TrimMemory(level, visible); |
1167 } | 1180 } |
1168 | 1181 |
1169 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1182 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1170 g_should_download_favicons = true; | 1183 g_should_download_favicons = true; |
1171 } | 1184 } |
1172 | 1185 |
1173 } // namespace android_webview | 1186 } // namespace android_webview |
OLD | NEW |