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

Unified Diff: android_webview/native/aw_settings.cc

Issue 143803016: [Android WebView] Fix thread unsafety in accessing Java side getters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added assert for the lock into the new getter (re-upload) 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 efb2e0e84a514a6dc7ccc3b430fb9a1776ff9e50..92bfbadc22e5a5a3974392361b6b58a4c9472fe7 100644
--- a/android_webview/native/aw_settings.cc
+++ b/android_webview/native/aw_settings.cc
@@ -188,14 +188,20 @@ void AwSettings::PopulateFixedPreferences(WebPreferences* web_prefs) {
void AwSettings::PopulateWebPreferences(WebPreferences* web_prefs) {
JNIEnv* env = base::android::AttachCurrentThread();
CHECK(env);
-
- AwRenderViewHostExt* render_view_host_ext = GetAwRenderViewHostExt();
- if (!render_view_host_ext) return;
-
ScopedJavaLocalRef<jobject> scoped_obj = aw_settings_.get(env);
jobject obj = scoped_obj.obj();
if (!obj) return;
+ // Grab the lock and call PopulateWebPreferencesLocked.
+ Java_AwSettings_populateWebPreferences(
+ env, obj, reinterpret_cast<jlong>(web_prefs));
+}
+
+void AwSettings::PopulateWebPreferencesLocked(
+ JNIEnv* env, jobject obj, jlong web_prefs_ptr) {
+ AwRenderViewHostExt* render_view_host_ext = GetAwRenderViewHostExt();
+ if (!render_view_host_ext) return;
+ WebPreferences* web_prefs = reinterpret_cast<WebPreferences*>(web_prefs_ptr);
PopulateFixedPreferences(web_prefs);
web_prefs->text_autosizing_enabled =
« 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