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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 561553002: aw: Invalidate view on hardware teardown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 892
893 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) { 893 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) {
894 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 894 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
895 ReleaseHardwareDrawIfNeeded(); 895 ReleaseHardwareDrawIfNeeded();
896 browser_view_renderer_.OnDetachedFromWindow(); 896 browser_view_renderer_.OnDetachedFromWindow();
897 } 897 }
898 898
899 void AwContents::ReleaseHardwareDrawIfNeeded() { 899 void AwContents::ReleaseHardwareDrawIfNeeded() {
900 InsideHardwareReleaseReset inside_reset(&shared_renderer_state_); 900 InsideHardwareReleaseReset inside_reset(&shared_renderer_state_);
901 901
902 JNIEnv* env = AttachCurrentThread();
903 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
904 if (!obj.is_null())
905 Java_AwContents_invalidateOnFunctorDestroy(env, obj.obj());
906
902 bool hardware_initialized = browser_view_renderer_.hardware_enabled(); 907 bool hardware_initialized = browser_view_renderer_.hardware_enabled();
903 if (hardware_initialized) { 908 if (hardware_initialized) {
904 bool draw_functor_succeeded = RequestDrawGL(NULL, true); 909 bool draw_functor_succeeded = RequestDrawGL(NULL, true);
905 if (!draw_functor_succeeded) { 910 if (!draw_functor_succeeded) {
906 LOG(ERROR) << "Unable to free GL resources. Has the Window leaked?"; 911 LOG(ERROR) << "Unable to free GL resources. Has the Window leaked?";
907 // Calling release on wrong thread intentionally. 912 // Calling release on wrong thread intentionally.
908 AwDrawGLInfo info; 913 AwDrawGLInfo info;
909 info.mode = AwDrawGLInfo::kModeProcess; 914 info.mode = AwDrawGLInfo::kModeProcess;
910 DrawGL(&info); 915 DrawGL(&info);
911 } 916 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 } 1170 }
1166 1171
1167 browser_view_renderer_.TrimMemory(level, visible); 1172 browser_view_renderer_.TrimMemory(level, visible);
1168 } 1173 }
1169 1174
1170 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1175 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1171 g_should_download_favicons = true; 1176 g_should_download_favicons = true;
1172 } 1177 }
1173 1178
1174 } // namespace android_webview 1179 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698