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

Unified Diff: android_webview/native/aw_settings.cc

Issue 140753006: [Android WebView] Turn on accelerated canvas based on View.isHardwareAccelerated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_settings.cc
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc
index 0a1312d6ec34ecccc65a359548e3240994a0f3c2..13c7f0879fca577eecf784776f3dc0db70999fc2 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,
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698