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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 void AwContents::Destroy(JNIEnv* env, jobject obj) { | 293 void AwContents::Destroy(JNIEnv* env, jobject obj) { |
294 java_ref_.reset(); | 294 java_ref_.reset(); |
295 | 295 |
296 // We clear the contents_client_bridge_ here so that we break the link with | 296 // We clear the contents_client_bridge_ here so that we break the link with |
297 // the java peer. This is important for the popup window case, where we are | 297 // the java peer. This is important for the popup window case, where we are |
298 // swapping AwContents out that share the same java AwContentsClientBridge. | 298 // swapping AwContents out that share the same java AwContentsClientBridge. |
299 // See b/15074651. | 299 // See b/15074651. |
300 AwContentsClientBridgeBase::Disassociate(web_contents_.get()); | 300 AwContentsClientBridgeBase::Disassociate(web_contents_.get()); |
301 contents_client_bridge_.reset(); | 301 contents_client_bridge_.reset(); |
302 | 302 |
| 303 // Do not wait until the WebContents are deleted asynchronously to clear |
| 304 // the delegate and stop sending callbacks. |
| 305 web_contents_->SetDelegate(NULL); |
| 306 |
303 // We do not delete AwContents immediately. Some applications try to delete | 307 // We do not delete AwContents immediately. Some applications try to delete |
304 // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from | 308 // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from |
305 // Webkit. | 309 // Webkit. |
306 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 310 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
307 } | 311 } |
308 | 312 |
309 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { | 313 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { |
310 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather | 314 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather |
311 // than hard-code the default instance lookup here. | 315 // than hard-code the default instance lookup here. |
312 scoped_ptr<WebContents> web_contents(content::WebContents::Create( | 316 scoped_ptr<WebContents> web_contents(content::WebContents::Create( |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } | 1171 } |
1168 | 1172 |
1169 browser_view_renderer_.TrimMemory(level, visible); | 1173 browser_view_renderer_.TrimMemory(level, visible); |
1170 } | 1174 } |
1171 | 1175 |
1172 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1176 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1173 g_should_download_favicons = true; | 1177 g_should_download_favicons = true; |
1174 } | 1178 } |
1175 | 1179 |
1176 } // namespace android_webview | 1180 } // namespace android_webview |
OLD | NEW |