diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-17 22:50:01 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-17 22:50:01 +0000 |
commit | 56aca707d0ad5ace8c5513dae5e31f964ad8f8be (patch) | |
tree | 914281fe049f47c5c3a2abb77d6815d269a13598 /android_webview/native/aw_settings.cc | |
parent | e842c17b0d0aaf1b389f56c7e12c0fff4b3b10bb (diff) | |
download | chromium_src-56aca707d0ad5ace8c5513dae5e31f964ad8f8be.zip chromium_src-56aca707d0ad5ace8c5513dae5e31f964ad8f8be.tar.gz chromium_src-56aca707d0ad5ace8c5513dae5e31f964ad8f8be.tar.bz2 |
[Android WebView] Turn on accelerated canvas based on View.isHardwareAccelerated
In onAttachedToWindow, check that if the view is hardware accelerated,
then enable hardware accelerated 2d canvas. Similarly disable canvas on
detach.
Note that accelerated 2d canvas is still off by default, but this patch
adds a command line switch to turn it on.
BUG=332273
Review URL: https://codereview.chromium.org/140753006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/native/aw_settings.cc')
-rw-r--r-- | android_webview/native/aw_settings.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index 0a1312d..13c7f08 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc @@ -8,12 +8,14 @@ #include "android_webview/native/aw_contents.h" #include "base/android/jni_android.h" #include "base/android/jni_string.h" +#include "base/command_line.h" #include "base/supports_user_data.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_client.h" +#include "content/public/common/content_switches.h" #include "jni/AwSettings_jni.h" #include "webkit/common/user_agent/user_agent.h" #include "webkit/common/webpreferences.h" @@ -45,6 +47,9 @@ class AwSettingsUserData : public base::SupportsUserData::Data { AwSettings::AwSettings(JNIEnv* env, jobject obj, jlong web_contents) : WebContentsObserver( reinterpret_cast<content::WebContents*>(web_contents)), + accelerated_2d_canvas_disabled_by_switch_( + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableAccelerated2dCanvas)), aw_settings_(env, obj) { reinterpret_cast<content::WebContents*>(web_contents)-> SetUserData(kAwSettingsUserDataKey, new AwSettingsUserData(this)); @@ -312,6 +317,11 @@ void AwSettings::PopulateWebPreferences(WebPreferences* web_prefs) { Java_AwSettings_getPasswordEchoEnabledLocked(env, obj); web_prefs->spatial_navigation_enabled = Java_AwSettings_getSpatialNavigationLocked(env, obj); + + web_prefs->accelerated_2d_canvas_enabled = + !accelerated_2d_canvas_disabled_by_switch_ && + Java_AwSettings_getEnableSupportedHardwareAcceleratedFeaturesLocked( + env, obj); } static jlong Init(JNIEnv* env, |