diff options
author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 18:52:36 +0000 |
---|---|---|
committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 18:52:36 +0000 |
commit | bc55afda3d6faefff7d5a63d9a44dde6e5a7b213 (patch) | |
tree | 54b80dac045a30cc2421296d9869a5cee2208793 /android_webview | |
parent | e86839fd84dde69dac9f61004ab6e6df0180f73e (diff) | |
download | chromium_src-bc55afda3d6faefff7d5a63d9a44dde6e5a7b213.zip chromium_src-bc55afda3d6faefff7d5a63d9a44dde6e5a7b213.tar.gz chromium_src-bc55afda3d6faefff7d5a63d9a44dde6e5a7b213.tar.bz2 |
Reenable deferred image decoding in WebView and add cache pruning.
This change issues a WebImageCache::clear() (which in turn prunes the
ImageDecodingStore cache) on every NEW navigation (i.e. it is not
invokes when the user continues the existing navigation clicking
around). This tradeoff will help controlling the ImageDecodingStore
cache which would otherwise keep on its saturation point of 32 MB.
This also reverts crrev.com/19958002 and reenable deferred
image decoding in WebView.
Note: this change will not be directly visible in the current sxs
benchmarks since those stay within the navigation boundary.
BUG=262957
Review URL: https://chromiumcodereview.appspot.com/23036005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/native/aw_settings.cc | 7 | ||||
-rw-r--r-- | android_webview/renderer/aw_render_view_ext.cc | 12 | ||||
-rw-r--r-- | android_webview/renderer/aw_render_view_ext.h | 1 |
3 files changed, 13 insertions, 7 deletions
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index a425402..f47b20b 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc @@ -206,13 +206,6 @@ void AwSettings::UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj) { prefs.support_deprecated_target_density_dpi = Java_AwSettings_getSupportDeprecatedTargetDensityDPILocked(env, obj); - // TODO(primiano): deferred image decoding seems to cause increased memory - // usage in WebView chromium after http://crrev.com/19838002 (at least on - // some tests, for instance +18MB on moz and moz2). Thus, deferred image - // decoding is being disabled until the root of the problem is found. - // See http://crbug.com/262957 . - prefs.deferred_image_decoding_enabled = false; - prefs.password_echo_enabled = Java_AwSettings_getPasswordEchoEnabled(env, obj); diff --git a/android_webview/renderer/aw_render_view_ext.cc b/android_webview/renderer/aw_render_view_ext.cc index 056bf69..9c51836 100644 --- a/android_webview/renderer/aw_render_view_ext.cc +++ b/android_webview/renderer/aw_render_view_ext.cc @@ -24,6 +24,7 @@ #include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebHitTestResult.h" +#include "third_party/WebKit/public/web/WebImageCache.h" #include "third_party/WebKit/public/web/WebNode.h" #include "third_party/WebKit/public/web/WebNodeList.h" #include "third_party/WebKit/public/web/WebSecurityOrigin.h" @@ -221,6 +222,17 @@ void AwRenderViewExt::UpdatePageScaleFactor() { } } +void AwRenderViewExt::Navigate(const GURL& url) { + // Navigate is called only on NEW navigations, so WebImageCache won't be freed + // when the user just clicks on links, but only when a navigation is started, + // for instance via loadUrl. A better approach would be clearing the cache on + // cross-site boundaries, however this would require too many changes both on + // the browser side (in RenderViewHostManger), to the IPCmessages and to the + // RenderViewObserver. Thus, clearing decoding image cache on Navigate, seems + // a more acceptable compromise. + WebKit::WebImageCache::clear(); +} + void AwRenderViewExt::FocusedNodeChanged(const WebKit::WebNode& node) { if (node.isNull() || !node.isElementNode() || !render_view()) return; diff --git a/android_webview/renderer/aw_render_view_ext.h b/android_webview/renderer/aw_render_view_ext.h index 744c045..031d513 100644 --- a/android_webview/renderer/aw_render_view_ext.h +++ b/android_webview/renderer/aw_render_view_ext.h @@ -38,6 +38,7 @@ class AwRenderViewExt : public content::RenderViewObserver, bool is_new_navigation) OVERRIDE; virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; virtual void DidCommitCompositorFrame() OVERRIDE; + virtual void Navigate(const GURL& url) OVERRIDE; void OnDocumentHasImagesRequest(int id); |