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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwSettings.java

Issue 143803016: [Android WebView] Fix thread unsafety in accessing Java side getters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed maybeRunOnUiThreadBlocking in a better way 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | android_webview/native/aw_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.pm.PackageManager; 8 import android.content.pm.PackageManager;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.Message; 10 import android.os.Message;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Custom handler that queues messages to call native code on the UI thread. 124 // Custom handler that queues messages to call native code on the UI thread.
125 private final EventHandler mEventHandler; 125 private final EventHandler mEventHandler;
126 126
127 private static final int MINIMUM_FONT_SIZE = 1; 127 private static final int MINIMUM_FONT_SIZE = 1;
128 private static final int MAXIMUM_FONT_SIZE = 72; 128 private static final int MAXIMUM_FONT_SIZE = 72;
129 129
130 // Class to handle messages to be processed on the UI thread. 130 // Class to handle messages to be processed on the UI thread.
131 private class EventHandler { 131 private class EventHandler {
132 // Message id for updating Webkit preferences 132 // Message id for updating Webkit preferences
133 private static final int UPDATE_WEBKIT_PREFERENCES = 0; 133 private static final int UPDATE_WEBKIT_PREFERENCES = 0;
134 // Message id for running a Runnable
benm (inactive) 2014/01/24 02:20:21 nit: ... with the AwSettingsLock held.
mnaganov (inactive) 2014/01/24 10:01:47 Done.
135 private static final int RUN_RUNNABLE_BLOCKING = 1;
134 // Actual UI thread handler 136 // Actual UI thread handler
135 private Handler mHandler; 137 private Handler mHandler;
136 138
137 EventHandler() { 139 EventHandler() {
138 } 140 }
139 141
140 void bindUiThread() { 142 void bindUiThread() {
141 if (mHandler != null) return; 143 if (mHandler != null) return;
142 mHandler = new Handler(ThreadUtils.getUiThreadLooper()) { 144 mHandler = new Handler(ThreadUtils.getUiThreadLooper()) {
143 @Override 145 @Override
144 public void handleMessage(Message msg) { 146 public void handleMessage(Message msg) {
145 switch (msg.what) { 147 switch (msg.what) {
146 case UPDATE_WEBKIT_PREFERENCES: 148 case UPDATE_WEBKIT_PREFERENCES:
147 synchronized (mAwSettingsLock) { 149 synchronized (mAwSettingsLock) {
148 updateWebkitPreferencesOnUiThreadLocked(); 150 updateWebkitPreferencesOnUiThreadLocked();
149 mIsUpdateWebkitPrefsMessagePending = false; 151 mIsUpdateWebkitPrefsMessagePending = false;
150 mAwSettingsLock.notifyAll(); 152 mAwSettingsLock.notifyAll();
151 } 153 }
152 break; 154 break;
155 case RUN_RUNNABLE_BLOCKING:
156 synchronized (mAwSettingsLock) {
157 ((Runnable)msg.obj).run();
158 mAwSettingsLock.notifyAll();
159 }
160 break;
153 } 161 }
154 } 162 }
155 }; 163 };
156 } 164 }
157 165
158 void maybeRunOnUiThreadBlocking(Runnable r) { 166 void maybeRunOnUiThreadBlocking(Runnable r) {
159 if (mHandler != null) { 167 assert Thread.holdsLock(mAwSettingsLock);
160 ThreadUtils.runOnUiThreadBlocking(r); 168 if (mHandler == null) return;
169 if (ThreadUtils.runningOnUiThread()) {
170 r.run();
171 } else {
172 mHandler.sendMessage(Message.obtain(null, RUN_RUNNABLE_BLOCKING, r));
173 try {
174 mAwSettingsLock.wait();
benm (inactive) 2014/01/24 02:20:21 shouldn't we have this in a while loop and set a b
mnaganov (inactive) 2014/01/24 10:01:47 Ah, of course! Even better -- fixing this makes up
175 } catch (InterruptedException e) {
176 Log.e(TAG, "Interrupted waiting a Runnable to complete", e);
177 }
161 } 178 }
162 } 179 }
163 180
164 void maybePostOnUiThread(Runnable r) { 181 void maybePostOnUiThread(Runnable r) {
165 if (mHandler != null) { 182 if (mHandler != null) {
166 mHandler.post(r); 183 mHandler.post(r);
167 } 184 }
168 } 185 }
169 186
170 private void updateWebkitPreferencesLocked() { 187 private void updateWebkitPreferencesLocked() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 248 }
232 249
233 @CalledByNative 250 @CalledByNative
234 private void nativeAwSettingsGone(long nativeAwSettings) { 251 private void nativeAwSettingsGone(long nativeAwSettings) {
235 assert mNativeAwSettings != 0 && mNativeAwSettings == nativeAwSettings; 252 assert mNativeAwSettings != 0 && mNativeAwSettings == nativeAwSettings;
236 mNativeAwSettings = 0; 253 mNativeAwSettings = 0;
237 } 254 }
238 255
239 @CalledByNative 256 @CalledByNative
240 private double getDIPScaleLocked() { 257 private double getDIPScaleLocked() {
258 assert Thread.holdsLock(mAwSettingsLock);
241 return mDIPScale; 259 return mDIPScale;
242 } 260 }
243 261
244 void setDIPScale(double dipScale) { 262 void setDIPScale(double dipScale) {
245 synchronized (mAwSettingsLock) { 263 synchronized (mAwSettingsLock) {
246 mDIPScale = dipScale; 264 mDIPScale = dipScale;
247 // TODO(joth): This should also be synced over to native side, but r ight now 265 // TODO(joth): This should also be synced over to native side, but r ight now
248 // the setDIPScale call is always followed by a setWebContents() whi ch covers this. 266 // the setDIPScale call is always followed by a setWebContents() whi ch covers this.
249 } 267 }
250 } 268 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 nativeUpdateInitialPageScaleLocked(mNativeAwSettings ); 393 nativeUpdateInitialPageScaleLocked(mNativeAwSettings );
376 } 394 }
377 } 395 }
378 }); 396 });
379 } 397 }
380 } 398 }
381 } 399 }
382 400
383 @CalledByNative 401 @CalledByNative
384 private float getInitialPageScalePercentLocked() { 402 private float getInitialPageScalePercentLocked() {
403 assert Thread.holdsLock(mAwSettingsLock);
385 return mInitialPageScalePercent; 404 return mInitialPageScalePercent;
386 } 405 }
387 406
388 void setSpatialNavigationEnabled(boolean enable) { 407 void setSpatialNavigationEnabled(boolean enable) {
389 synchronized (mAwSettingsLock) { 408 synchronized (mAwSettingsLock) {
390 if (mSpatialNavigationEnabled != enable) { 409 if (mSpatialNavigationEnabled != enable) {
391 mSpatialNavigationEnabled = enable; 410 mSpatialNavigationEnabled = enable;
392 mEventHandler.updateWebkitPreferencesLocked(); 411 mEventHandler.updateWebkitPreferencesLocked();
393 } 412 }
394 } 413 }
395 } 414 }
396 415
397 @CalledByNative 416 @CalledByNative
398 private boolean getSpatialNavigationLocked() { 417 private boolean getSpatialNavigationLocked() {
418 assert Thread.holdsLock(mAwSettingsLock);
399 return mSpatialNavigationEnabled; 419 return mSpatialNavigationEnabled;
400 } 420 }
401 421
402 void setEnableSupportedHardwareAcceleratedFeatures(boolean enable) { 422 void setEnableSupportedHardwareAcceleratedFeatures(boolean enable) {
403 synchronized (mAwSettingsLock) { 423 synchronized (mAwSettingsLock) {
404 if (mEnableSupportedHardwareAcceleratedFeatures != enable) { 424 if (mEnableSupportedHardwareAcceleratedFeatures != enable) {
405 mEnableSupportedHardwareAcceleratedFeatures = enable; 425 mEnableSupportedHardwareAcceleratedFeatures = enable;
406 mEventHandler.updateWebkitPreferencesLocked(); 426 mEventHandler.updateWebkitPreferencesLocked();
407 } 427 }
408 } 428 }
409 } 429 }
410 430
411 @CalledByNative 431 @CalledByNative
412 private boolean getEnableSupportedHardwareAcceleratedFeaturesLocked() { 432 private boolean getEnableSupportedHardwareAcceleratedFeaturesLocked() {
433 assert Thread.holdsLock(mAwSettingsLock);
413 return mEnableSupportedHardwareAcceleratedFeatures; 434 return mEnableSupportedHardwareAcceleratedFeatures;
414 } 435 }
415 436
416 /** 437 /**
417 * See {@link android.webkit.WebSettings#setNeedInitialFocus}. 438 * See {@link android.webkit.WebSettings#setNeedInitialFocus}.
418 */ 439 */
419 public boolean shouldFocusFirstNode() { 440 public boolean shouldFocusFirstNode() {
420 synchronized (mAwSettingsLock) { 441 synchronized (mAwSettingsLock) {
421 return mShouldFocusFirstNode; 442 return mShouldFocusFirstNode;
422 } 443 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 * See {@link android.webkit.WebSettings#getSaveFormData}. 486 * See {@link android.webkit.WebSettings#getSaveFormData}.
466 */ 487 */
467 public boolean getSaveFormData() { 488 public boolean getSaveFormData() {
468 synchronized (mAwSettingsLock) { 489 synchronized (mAwSettingsLock) {
469 return getSaveFormDataLocked(); 490 return getSaveFormDataLocked();
470 } 491 }
471 } 492 }
472 493
473 @CalledByNative 494 @CalledByNative
474 private boolean getSaveFormDataLocked() { 495 private boolean getSaveFormDataLocked() {
496 assert Thread.holdsLock(mAwSettingsLock);
475 return mAutoCompleteEnabled; 497 return mAutoCompleteEnabled;
476 } 498 }
477 499
478 /** 500 /**
479 * @returns the default User-Agent used by each ContentViewCore instance, i. e. unless 501 * @returns the default User-Agent used by each ContentViewCore instance, i. e. unless
480 * overridden by {@link #setUserAgentString()} 502 * overridden by {@link #setUserAgentString()}
481 */ 503 */
482 public static String getDefaultUserAgent() { 504 public static String getDefaultUserAgent() {
483 return LazyDefaultUserAgent.sInstance; 505 return LazyDefaultUserAgent.sInstance;
484 } 506 }
(...skipping 26 matching lines...) Expand all
511 * See {@link android.webkit.WebSettings#getUserAgentString}. 533 * See {@link android.webkit.WebSettings#getUserAgentString}.
512 */ 534 */
513 public String getUserAgentString() { 535 public String getUserAgentString() {
514 synchronized (mAwSettingsLock) { 536 synchronized (mAwSettingsLock) {
515 return mUserAgent; 537 return mUserAgent;
516 } 538 }
517 } 539 }
518 540
519 @CalledByNative 541 @CalledByNative
520 private String getUserAgentLocked() { 542 private String getUserAgentLocked() {
543 assert Thread.holdsLock(mAwSettingsLock);
521 return mUserAgent; 544 return mUserAgent;
522 } 545 }
523 546
524 /** 547 /**
525 * See {@link android.webkit.WebSettings#setLoadWithOverviewMode}. 548 * See {@link android.webkit.WebSettings#setLoadWithOverviewMode}.
526 */ 549 */
527 public void setLoadWithOverviewMode(boolean overview) { 550 public void setLoadWithOverviewMode(boolean overview) {
528 synchronized (mAwSettingsLock) { 551 synchronized (mAwSettingsLock) {
529 if (mLoadWithOverviewMode != overview) { 552 if (mLoadWithOverviewMode != overview) {
530 mLoadWithOverviewMode = overview; 553 mLoadWithOverviewMode = overview;
(...skipping 14 matching lines...) Expand all
545 * See {@link android.webkit.WebSettings#getLoadWithOverviewMode}. 568 * See {@link android.webkit.WebSettings#getLoadWithOverviewMode}.
546 */ 569 */
547 public boolean getLoadWithOverviewMode() { 570 public boolean getLoadWithOverviewMode() {
548 synchronized (mAwSettingsLock) { 571 synchronized (mAwSettingsLock) {
549 return mLoadWithOverviewMode; 572 return mLoadWithOverviewMode;
550 } 573 }
551 } 574 }
552 575
553 @CalledByNative 576 @CalledByNative
554 private boolean getLoadWithOverviewModeLocked() { 577 private boolean getLoadWithOverviewModeLocked() {
578 assert Thread.holdsLock(mAwSettingsLock);
555 return mLoadWithOverviewMode; 579 return mLoadWithOverviewMode;
556 } 580 }
557 581
558 /** 582 /**
559 * See {@link android.webkit.WebSettings#setTextZoom}. 583 * See {@link android.webkit.WebSettings#setTextZoom}.
560 */ 584 */
561 public void setTextZoom(final int textZoom) { 585 public void setTextZoom(final int textZoom) {
562 synchronized (mAwSettingsLock) { 586 synchronized (mAwSettingsLock) {
563 int scaledTextZoomPercent = (int)(textZoom * mFontScale); 587 int scaledTextZoomPercent = (int)(textZoom * mFontScale);
564 if (mTextSizePercent != scaledTextZoomPercent) { 588 if (mTextSizePercent != scaledTextZoomPercent) {
565 mTextSizePercent = scaledTextZoomPercent; 589 mTextSizePercent = scaledTextZoomPercent;
566 mEventHandler.updateWebkitPreferencesLocked(); 590 mEventHandler.updateWebkitPreferencesLocked();
567 } 591 }
568 } 592 }
569 } 593 }
570 594
571 /** 595 /**
572 * See {@link android.webkit.WebSettings#getTextZoom}. 596 * See {@link android.webkit.WebSettings#getTextZoom}.
573 */ 597 */
574 public int getTextZoom() { 598 public int getTextZoom() {
575 synchronized (mAwSettingsLock) { 599 synchronized (mAwSettingsLock) {
576 return mTextSizePercent; 600 return mTextSizePercent;
577 } 601 }
578 } 602 }
579 603
580 @CalledByNative 604 @CalledByNative
581 private int getTextSizePercentLocked() { 605 private int getTextSizePercentLocked() {
606 assert Thread.holdsLock(mAwSettingsLock);
582 return mTextSizePercent; 607 return mTextSizePercent;
583 } 608 }
584 609
585 /** 610 /**
586 * See {@link android.webkit.WebSettings#setStandardFontFamily}. 611 * See {@link android.webkit.WebSettings#setStandardFontFamily}.
587 */ 612 */
588 public void setStandardFontFamily(String font) { 613 public void setStandardFontFamily(String font) {
589 synchronized (mAwSettingsLock) { 614 synchronized (mAwSettingsLock) {
590 if (font != null && !mStandardFontFamily.equals(font)) { 615 if (font != null && !mStandardFontFamily.equals(font)) {
591 mStandardFontFamily = font; 616 mStandardFontFamily = font;
592 mEventHandler.updateWebkitPreferencesLocked(); 617 mEventHandler.updateWebkitPreferencesLocked();
593 } 618 }
594 } 619 }
595 } 620 }
596 621
597 /** 622 /**
598 * See {@link android.webkit.WebSettings#getStandardFontFamily}. 623 * See {@link android.webkit.WebSettings#getStandardFontFamily}.
599 */ 624 */
600 public String getStandardFontFamily() { 625 public String getStandardFontFamily() {
601 synchronized (mAwSettingsLock) { 626 synchronized (mAwSettingsLock) {
602 return mStandardFontFamily; 627 return mStandardFontFamily;
603 } 628 }
604 } 629 }
605 630
606 @CalledByNative 631 @CalledByNative
607 private String getStandardFontFamilyLocked() { 632 private String getStandardFontFamilyLocked() {
633 assert Thread.holdsLock(mAwSettingsLock);
608 return mStandardFontFamily; 634 return mStandardFontFamily;
609 } 635 }
610 636
611 /** 637 /**
612 * See {@link android.webkit.WebSettings#setFixedFontFamily}. 638 * See {@link android.webkit.WebSettings#setFixedFontFamily}.
613 */ 639 */
614 public void setFixedFontFamily(String font) { 640 public void setFixedFontFamily(String font) {
615 synchronized (mAwSettingsLock) { 641 synchronized (mAwSettingsLock) {
616 if (font != null && !mFixedFontFamily.equals(font)) { 642 if (font != null && !mFixedFontFamily.equals(font)) {
617 mFixedFontFamily = font; 643 mFixedFontFamily = font;
618 mEventHandler.updateWebkitPreferencesLocked(); 644 mEventHandler.updateWebkitPreferencesLocked();
619 } 645 }
620 } 646 }
621 } 647 }
622 648
623 /** 649 /**
624 * See {@link android.webkit.WebSettings#getFixedFontFamily}. 650 * See {@link android.webkit.WebSettings#getFixedFontFamily}.
625 */ 651 */
626 public String getFixedFontFamily() { 652 public String getFixedFontFamily() {
627 synchronized (mAwSettingsLock) { 653 synchronized (mAwSettingsLock) {
628 return mFixedFontFamily; 654 return mFixedFontFamily;
629 } 655 }
630 } 656 }
631 657
632 @CalledByNative 658 @CalledByNative
633 private String getFixedFontFamilyLocked() { 659 private String getFixedFontFamilyLocked() {
660 assert Thread.holdsLock(mAwSettingsLock);
634 return mFixedFontFamily; 661 return mFixedFontFamily;
635 } 662 }
636 663
637 /** 664 /**
638 * See {@link android.webkit.WebSettings#setSansSerifFontFamily}. 665 * See {@link android.webkit.WebSettings#setSansSerifFontFamily}.
639 */ 666 */
640 public void setSansSerifFontFamily(String font) { 667 public void setSansSerifFontFamily(String font) {
641 synchronized (mAwSettingsLock) { 668 synchronized (mAwSettingsLock) {
642 if (font != null && !mSansSerifFontFamily.equals(font)) { 669 if (font != null && !mSansSerifFontFamily.equals(font)) {
643 mSansSerifFontFamily = font; 670 mSansSerifFontFamily = font;
644 mEventHandler.updateWebkitPreferencesLocked(); 671 mEventHandler.updateWebkitPreferencesLocked();
645 } 672 }
646 } 673 }
647 } 674 }
648 675
649 /** 676 /**
650 * See {@link android.webkit.WebSettings#getSansSerifFontFamily}. 677 * See {@link android.webkit.WebSettings#getSansSerifFontFamily}.
651 */ 678 */
652 public String getSansSerifFontFamily() { 679 public String getSansSerifFontFamily() {
653 synchronized (mAwSettingsLock) { 680 synchronized (mAwSettingsLock) {
654 return mSansSerifFontFamily; 681 return mSansSerifFontFamily;
655 } 682 }
656 } 683 }
657 684
658 @CalledByNative 685 @CalledByNative
659 private String getSansSerifFontFamilyLocked() { 686 private String getSansSerifFontFamilyLocked() {
687 assert Thread.holdsLock(mAwSettingsLock);
660 return mSansSerifFontFamily; 688 return mSansSerifFontFamily;
661 } 689 }
662 690
663 /** 691 /**
664 * See {@link android.webkit.WebSettings#setSerifFontFamily}. 692 * See {@link android.webkit.WebSettings#setSerifFontFamily}.
665 */ 693 */
666 public void setSerifFontFamily(String font) { 694 public void setSerifFontFamily(String font) {
667 synchronized (mAwSettingsLock) { 695 synchronized (mAwSettingsLock) {
668 if (font != null && !mSerifFontFamily.equals(font)) { 696 if (font != null && !mSerifFontFamily.equals(font)) {
669 mSerifFontFamily = font; 697 mSerifFontFamily = font;
670 mEventHandler.updateWebkitPreferencesLocked(); 698 mEventHandler.updateWebkitPreferencesLocked();
671 } 699 }
672 } 700 }
673 } 701 }
674 702
675 /** 703 /**
676 * See {@link android.webkit.WebSettings#getSerifFontFamily}. 704 * See {@link android.webkit.WebSettings#getSerifFontFamily}.
677 */ 705 */
678 public String getSerifFontFamily() { 706 public String getSerifFontFamily() {
679 synchronized (mAwSettingsLock) { 707 synchronized (mAwSettingsLock) {
680 return mSerifFontFamily; 708 return mSerifFontFamily;
681 } 709 }
682 } 710 }
683 711
684 @CalledByNative 712 @CalledByNative
685 private String getSerifFontFamilyLocked() { 713 private String getSerifFontFamilyLocked() {
714 assert Thread.holdsLock(mAwSettingsLock);
686 return mSerifFontFamily; 715 return mSerifFontFamily;
687 } 716 }
688 717
689 /** 718 /**
690 * See {@link android.webkit.WebSettings#setCursiveFontFamily}. 719 * See {@link android.webkit.WebSettings#setCursiveFontFamily}.
691 */ 720 */
692 public void setCursiveFontFamily(String font) { 721 public void setCursiveFontFamily(String font) {
693 synchronized (mAwSettingsLock) { 722 synchronized (mAwSettingsLock) {
694 if (font != null && !mCursiveFontFamily.equals(font)) { 723 if (font != null && !mCursiveFontFamily.equals(font)) {
695 mCursiveFontFamily = font; 724 mCursiveFontFamily = font;
696 mEventHandler.updateWebkitPreferencesLocked(); 725 mEventHandler.updateWebkitPreferencesLocked();
697 } 726 }
698 } 727 }
699 } 728 }
700 729
701 /** 730 /**
702 * See {@link android.webkit.WebSettings#getCursiveFontFamily}. 731 * See {@link android.webkit.WebSettings#getCursiveFontFamily}.
703 */ 732 */
704 public String getCursiveFontFamily() { 733 public String getCursiveFontFamily() {
705 synchronized (mAwSettingsLock) { 734 synchronized (mAwSettingsLock) {
706 return mCursiveFontFamily; 735 return mCursiveFontFamily;
707 } 736 }
708 } 737 }
709 738
710 @CalledByNative 739 @CalledByNative
711 private String getCursiveFontFamilyLocked() { 740 private String getCursiveFontFamilyLocked() {
741 assert Thread.holdsLock(mAwSettingsLock);
712 return mCursiveFontFamily; 742 return mCursiveFontFamily;
713 } 743 }
714 744
715 /** 745 /**
716 * See {@link android.webkit.WebSettings#setFantasyFontFamily}. 746 * See {@link android.webkit.WebSettings#setFantasyFontFamily}.
717 */ 747 */
718 public void setFantasyFontFamily(String font) { 748 public void setFantasyFontFamily(String font) {
719 synchronized (mAwSettingsLock) { 749 synchronized (mAwSettingsLock) {
720 if (font != null && !mFantasyFontFamily.equals(font)) { 750 if (font != null && !mFantasyFontFamily.equals(font)) {
721 mFantasyFontFamily = font; 751 mFantasyFontFamily = font;
722 mEventHandler.updateWebkitPreferencesLocked(); 752 mEventHandler.updateWebkitPreferencesLocked();
723 } 753 }
724 } 754 }
725 } 755 }
726 756
727 /** 757 /**
728 * See {@link android.webkit.WebSettings#getFantasyFontFamily}. 758 * See {@link android.webkit.WebSettings#getFantasyFontFamily}.
729 */ 759 */
730 public String getFantasyFontFamily() { 760 public String getFantasyFontFamily() {
731 synchronized (mAwSettingsLock) { 761 synchronized (mAwSettingsLock) {
732 return mFantasyFontFamily; 762 return mFantasyFontFamily;
733 } 763 }
734 } 764 }
735 765
736 @CalledByNative 766 @CalledByNative
737 private String getFantasyFontFamilyLocked() { 767 private String getFantasyFontFamilyLocked() {
768 assert Thread.holdsLock(mAwSettingsLock);
738 return mFantasyFontFamily; 769 return mFantasyFontFamily;
739 } 770 }
740 771
741 /** 772 /**
742 * See {@link android.webkit.WebSettings#setMinimumFontSize}. 773 * See {@link android.webkit.WebSettings#setMinimumFontSize}.
743 */ 774 */
744 public void setMinimumFontSize(int size) { 775 public void setMinimumFontSize(int size) {
745 synchronized (mAwSettingsLock) { 776 synchronized (mAwSettingsLock) {
746 size = clipFontSize(size); 777 size = clipFontSize(size);
747 if (mMinimumFontSize != size) { 778 if (mMinimumFontSize != size) {
748 mMinimumFontSize = size; 779 mMinimumFontSize = size;
749 mEventHandler.updateWebkitPreferencesLocked(); 780 mEventHandler.updateWebkitPreferencesLocked();
750 } 781 }
751 } 782 }
752 } 783 }
753 784
754 /** 785 /**
755 * See {@link android.webkit.WebSettings#getMinimumFontSize}. 786 * See {@link android.webkit.WebSettings#getMinimumFontSize}.
756 */ 787 */
757 public int getMinimumFontSize() { 788 public int getMinimumFontSize() {
758 synchronized (mAwSettingsLock) { 789 synchronized (mAwSettingsLock) {
759 return mMinimumFontSize; 790 return mMinimumFontSize;
760 } 791 }
761 } 792 }
762 793
763 @CalledByNative 794 @CalledByNative
764 private int getMinimumFontSizeLocked() { 795 private int getMinimumFontSizeLocked() {
796 assert Thread.holdsLock(mAwSettingsLock);
765 return mMinimumFontSize; 797 return mMinimumFontSize;
766 } 798 }
767 799
768 /** 800 /**
769 * See {@link android.webkit.WebSettings#setMinimumLogicalFontSize}. 801 * See {@link android.webkit.WebSettings#setMinimumLogicalFontSize}.
770 */ 802 */
771 public void setMinimumLogicalFontSize(int size) { 803 public void setMinimumLogicalFontSize(int size) {
772 synchronized (mAwSettingsLock) { 804 synchronized (mAwSettingsLock) {
773 size = clipFontSize(size); 805 size = clipFontSize(size);
774 if (mMinimumLogicalFontSize != size) { 806 if (mMinimumLogicalFontSize != size) {
775 mMinimumLogicalFontSize = size; 807 mMinimumLogicalFontSize = size;
776 mEventHandler.updateWebkitPreferencesLocked(); 808 mEventHandler.updateWebkitPreferencesLocked();
777 } 809 }
778 } 810 }
779 } 811 }
780 812
781 /** 813 /**
782 * See {@link android.webkit.WebSettings#getMinimumLogicalFontSize}. 814 * See {@link android.webkit.WebSettings#getMinimumLogicalFontSize}.
783 */ 815 */
784 public int getMinimumLogicalFontSize() { 816 public int getMinimumLogicalFontSize() {
785 synchronized (mAwSettingsLock) { 817 synchronized (mAwSettingsLock) {
786 return mMinimumLogicalFontSize; 818 return mMinimumLogicalFontSize;
787 } 819 }
788 } 820 }
789 821
790 @CalledByNative 822 @CalledByNative
791 private int getMinimumLogicalFontSizeLocked() { 823 private int getMinimumLogicalFontSizeLocked() {
824 assert Thread.holdsLock(mAwSettingsLock);
792 return mMinimumLogicalFontSize; 825 return mMinimumLogicalFontSize;
793 } 826 }
794 827
795 /** 828 /**
796 * See {@link android.webkit.WebSettings#setDefaultFontSize}. 829 * See {@link android.webkit.WebSettings#setDefaultFontSize}.
797 */ 830 */
798 public void setDefaultFontSize(int size) { 831 public void setDefaultFontSize(int size) {
799 synchronized (mAwSettingsLock) { 832 synchronized (mAwSettingsLock) {
800 size = clipFontSize(size); 833 size = clipFontSize(size);
801 if (mDefaultFontSize != size) { 834 if (mDefaultFontSize != size) {
802 mDefaultFontSize = size; 835 mDefaultFontSize = size;
803 mEventHandler.updateWebkitPreferencesLocked(); 836 mEventHandler.updateWebkitPreferencesLocked();
804 } 837 }
805 } 838 }
806 } 839 }
807 840
808 /** 841 /**
809 * See {@link android.webkit.WebSettings#getDefaultFontSize}. 842 * See {@link android.webkit.WebSettings#getDefaultFontSize}.
810 */ 843 */
811 public int getDefaultFontSize() { 844 public int getDefaultFontSize() {
812 synchronized (mAwSettingsLock) { 845 synchronized (mAwSettingsLock) {
813 return mDefaultFontSize; 846 return mDefaultFontSize;
814 } 847 }
815 } 848 }
816 849
817 @CalledByNative 850 @CalledByNative
818 private int getDefaultFontSizeLocked() { 851 private int getDefaultFontSizeLocked() {
852 assert Thread.holdsLock(mAwSettingsLock);
819 return mDefaultFontSize; 853 return mDefaultFontSize;
820 } 854 }
821 855
822 /** 856 /**
823 * See {@link android.webkit.WebSettings#setDefaultFixedFontSize}. 857 * See {@link android.webkit.WebSettings#setDefaultFixedFontSize}.
824 */ 858 */
825 public void setDefaultFixedFontSize(int size) { 859 public void setDefaultFixedFontSize(int size) {
826 synchronized (mAwSettingsLock) { 860 synchronized (mAwSettingsLock) {
827 size = clipFontSize(size); 861 size = clipFontSize(size);
828 if (mDefaultFixedFontSize != size) { 862 if (mDefaultFixedFontSize != size) {
829 mDefaultFixedFontSize = size; 863 mDefaultFixedFontSize = size;
830 mEventHandler.updateWebkitPreferencesLocked(); 864 mEventHandler.updateWebkitPreferencesLocked();
831 } 865 }
832 } 866 }
833 } 867 }
834 868
835 /** 869 /**
836 * See {@link android.webkit.WebSettings#getDefaultFixedFontSize}. 870 * See {@link android.webkit.WebSettings#getDefaultFixedFontSize}.
837 */ 871 */
838 public int getDefaultFixedFontSize() { 872 public int getDefaultFixedFontSize() {
839 synchronized (mAwSettingsLock) { 873 synchronized (mAwSettingsLock) {
840 return mDefaultFixedFontSize; 874 return mDefaultFixedFontSize;
841 } 875 }
842 } 876 }
843 877
844 @CalledByNative 878 @CalledByNative
845 private int getDefaultFixedFontSizeLocked() { 879 private int getDefaultFixedFontSizeLocked() {
880 assert Thread.holdsLock(mAwSettingsLock);
846 return mDefaultFixedFontSize; 881 return mDefaultFixedFontSize;
847 } 882 }
848 883
849 /** 884 /**
850 * See {@link android.webkit.WebSettings#setJavaScriptEnabled}. 885 * See {@link android.webkit.WebSettings#setJavaScriptEnabled}.
851 */ 886 */
852 public void setJavaScriptEnabled(boolean flag) { 887 public void setJavaScriptEnabled(boolean flag) {
853 synchronized (mAwSettingsLock) { 888 synchronized (mAwSettingsLock) {
854 if (mJavaScriptEnabled != flag) { 889 if (mJavaScriptEnabled != flag) {
855 mJavaScriptEnabled = flag; 890 mJavaScriptEnabled = flag;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 * See {@link android.webkit.WebSettings#getLoadsImagesAutomatically}. 933 * See {@link android.webkit.WebSettings#getLoadsImagesAutomatically}.
899 */ 934 */
900 public boolean getLoadsImagesAutomatically() { 935 public boolean getLoadsImagesAutomatically() {
901 synchronized (mAwSettingsLock) { 936 synchronized (mAwSettingsLock) {
902 return mLoadsImagesAutomatically; 937 return mLoadsImagesAutomatically;
903 } 938 }
904 } 939 }
905 940
906 @CalledByNative 941 @CalledByNative
907 private boolean getLoadsImagesAutomaticallyLocked() { 942 private boolean getLoadsImagesAutomaticallyLocked() {
943 assert Thread.holdsLock(mAwSettingsLock);
908 return mLoadsImagesAutomatically; 944 return mLoadsImagesAutomatically;
909 } 945 }
910 946
911 /** 947 /**
912 * See {@link android.webkit.WebSettings#setImagesEnabled}. 948 * See {@link android.webkit.WebSettings#setImagesEnabled}.
913 */ 949 */
914 public void setImagesEnabled(boolean flag) { 950 public void setImagesEnabled(boolean flag) {
915 synchronized (mAwSettingsLock) { 951 synchronized (mAwSettingsLock) {
916 if (mImagesEnabled != flag) { 952 if (mImagesEnabled != flag) {
917 mImagesEnabled = flag; 953 mImagesEnabled = flag;
918 mEventHandler.updateWebkitPreferencesLocked(); 954 mEventHandler.updateWebkitPreferencesLocked();
919 } 955 }
920 } 956 }
921 } 957 }
922 958
923 /** 959 /**
924 * See {@link android.webkit.WebSettings#getImagesEnabled}. 960 * See {@link android.webkit.WebSettings#getImagesEnabled}.
925 */ 961 */
926 public boolean getImagesEnabled() { 962 public boolean getImagesEnabled() {
927 synchronized (mAwSettingsLock) { 963 synchronized (mAwSettingsLock) {
928 return mImagesEnabled; 964 return mImagesEnabled;
929 } 965 }
930 } 966 }
931 967
932 @CalledByNative 968 @CalledByNative
933 private boolean getImagesEnabledLocked() { 969 private boolean getImagesEnabledLocked() {
970 assert Thread.holdsLock(mAwSettingsLock);
934 return mImagesEnabled; 971 return mImagesEnabled;
935 } 972 }
936 973
937 /** 974 /**
938 * See {@link android.webkit.WebSettings#getJavaScriptEnabled}. 975 * See {@link android.webkit.WebSettings#getJavaScriptEnabled}.
939 */ 976 */
940 public boolean getJavaScriptEnabled() { 977 public boolean getJavaScriptEnabled() {
941 synchronized (mAwSettingsLock) { 978 synchronized (mAwSettingsLock) {
942 return mJavaScriptEnabled; 979 return mJavaScriptEnabled;
943 } 980 }
944 } 981 }
945 982
946 @CalledByNative 983 @CalledByNative
947 private boolean getJavaScriptEnabledLocked() { 984 private boolean getJavaScriptEnabledLocked() {
985 assert Thread.holdsLock(mAwSettingsLock);
948 return mJavaScriptEnabled; 986 return mJavaScriptEnabled;
949 } 987 }
950 988
951 /** 989 /**
952 * See {@link android.webkit.WebSettings#getAllowUniversalAccessFromFileURLs }. 990 * See {@link android.webkit.WebSettings#getAllowUniversalAccessFromFileURLs }.
953 */ 991 */
954 public boolean getAllowUniversalAccessFromFileURLs() { 992 public boolean getAllowUniversalAccessFromFileURLs() {
955 synchronized (mAwSettingsLock) { 993 synchronized (mAwSettingsLock) {
956 return mAllowUniversalAccessFromFileURLs; 994 return mAllowUniversalAccessFromFileURLs;
957 } 995 }
958 } 996 }
959 997
960 @CalledByNative 998 @CalledByNative
961 private boolean getAllowUniversalAccessFromFileURLsLocked() { 999 private boolean getAllowUniversalAccessFromFileURLsLocked() {
1000 assert Thread.holdsLock(mAwSettingsLock);
962 return mAllowUniversalAccessFromFileURLs; 1001 return mAllowUniversalAccessFromFileURLs;
963 } 1002 }
964 1003
965 /** 1004 /**
966 * See {@link android.webkit.WebSettings#getAllowFileAccessFromFileURLs}. 1005 * See {@link android.webkit.WebSettings#getAllowFileAccessFromFileURLs}.
967 */ 1006 */
968 public boolean getAllowFileAccessFromFileURLs() { 1007 public boolean getAllowFileAccessFromFileURLs() {
969 synchronized (mAwSettingsLock) { 1008 synchronized (mAwSettingsLock) {
970 return mAllowFileAccessFromFileURLs; 1009 return mAllowFileAccessFromFileURLs;
971 } 1010 }
972 } 1011 }
973 1012
974 @CalledByNative 1013 @CalledByNative
975 private boolean getAllowFileAccessFromFileURLsLocked() { 1014 private boolean getAllowFileAccessFromFileURLsLocked() {
1015 assert Thread.holdsLock(mAwSettingsLock);
976 return mAllowFileAccessFromFileURLs; 1016 return mAllowFileAccessFromFileURLs;
977 } 1017 }
978 1018
979 /** 1019 /**
980 * See {@link android.webkit.WebSettings#setPluginsEnabled}. 1020 * See {@link android.webkit.WebSettings#setPluginsEnabled}.
981 */ 1021 */
982 public void setPluginsEnabled(boolean flag) { 1022 public void setPluginsEnabled(boolean flag) {
983 setPluginState(flag ? PluginState.ON : PluginState.OFF); 1023 setPluginState(flag ? PluginState.ON : PluginState.OFF);
984 } 1024 }
985 1025
(...skipping 14 matching lines...) Expand all
1000 */ 1040 */
1001 public boolean getPluginsEnabled() { 1041 public boolean getPluginsEnabled() {
1002 synchronized (mAwSettingsLock) { 1042 synchronized (mAwSettingsLock) {
1003 return mPluginState == PluginState.ON; 1043 return mPluginState == PluginState.ON;
1004 } 1044 }
1005 } 1045 }
1006 1046
1007 /** 1047 /**
1008 * Return true if plugins are disabled. 1048 * Return true if plugins are disabled.
1009 * @return True if plugins are disabled. 1049 * @return True if plugins are disabled.
1010 * @hide
1011 */ 1050 */
1012 @CalledByNative 1051 @CalledByNative
1013 private boolean getPluginsDisabledLocked() { 1052 private boolean getPluginsDisabledLocked() {
1053 assert Thread.holdsLock(mAwSettingsLock);
1014 return mPluginState == PluginState.OFF; 1054 return mPluginState == PluginState.OFF;
1015 } 1055 }
1016 1056
1017 /** 1057 /**
1018 * See {@link android.webkit.WebSettings#getPluginState}. 1058 * See {@link android.webkit.WebSettings#getPluginState}.
1019 */ 1059 */
1020 public PluginState getPluginState() { 1060 public PluginState getPluginState() {
1021 synchronized (mAwSettingsLock) { 1061 synchronized (mAwSettingsLock) {
1022 return mPluginState; 1062 return mPluginState;
1023 } 1063 }
(...skipping 16 matching lines...) Expand all
1040 * See {@link android.webkit.WebSettings#getJavaScriptCanOpenWindowsAutomati cally}. 1080 * See {@link android.webkit.WebSettings#getJavaScriptCanOpenWindowsAutomati cally}.
1041 */ 1081 */
1042 public boolean getJavaScriptCanOpenWindowsAutomatically() { 1082 public boolean getJavaScriptCanOpenWindowsAutomatically() {
1043 synchronized (mAwSettingsLock) { 1083 synchronized (mAwSettingsLock) {
1044 return mJavaScriptCanOpenWindowsAutomatically; 1084 return mJavaScriptCanOpenWindowsAutomatically;
1045 } 1085 }
1046 } 1086 }
1047 1087
1048 @CalledByNative 1088 @CalledByNative
1049 private boolean getJavaScriptCanOpenWindowsAutomaticallyLocked() { 1089 private boolean getJavaScriptCanOpenWindowsAutomaticallyLocked() {
1090 assert Thread.holdsLock(mAwSettingsLock);
1050 return mJavaScriptCanOpenWindowsAutomatically; 1091 return mJavaScriptCanOpenWindowsAutomatically;
1051 } 1092 }
1052 1093
1053 /** 1094 /**
1054 * See {@link android.webkit.WebSettings#setLayoutAlgorithm}. 1095 * See {@link android.webkit.WebSettings#setLayoutAlgorithm}.
1055 */ 1096 */
1056 public void setLayoutAlgorithm(LayoutAlgorithm l) { 1097 public void setLayoutAlgorithm(LayoutAlgorithm l) {
1057 synchronized (mAwSettingsLock) { 1098 synchronized (mAwSettingsLock) {
1058 if (mLayoutAlgorithm != l) { 1099 if (mLayoutAlgorithm != l) {
1059 mLayoutAlgorithm = l; 1100 mLayoutAlgorithm = l;
1060 mEventHandler.updateWebkitPreferencesLocked(); 1101 mEventHandler.updateWebkitPreferencesLocked();
1061 } 1102 }
1062 } 1103 }
1063 } 1104 }
1064 1105
1065 /** 1106 /**
1066 * See {@link android.webkit.WebSettings#getLayoutAlgorithm}. 1107 * See {@link android.webkit.WebSettings#getLayoutAlgorithm}.
1067 */ 1108 */
1068 public LayoutAlgorithm getLayoutAlgorithm() { 1109 public LayoutAlgorithm getLayoutAlgorithm() {
1069 synchronized (mAwSettingsLock) { 1110 synchronized (mAwSettingsLock) {
1070 return mLayoutAlgorithm; 1111 return mLayoutAlgorithm;
1071 } 1112 }
1072 } 1113 }
1073 1114
1074 /** 1115 /**
1075 * Gets whether Text Auto-sizing layout algorithm is enabled. 1116 * Gets whether Text Auto-sizing layout algorithm is enabled.
1076 * 1117 *
1077 * @return true if Text Auto-sizing layout algorithm is enabled 1118 * @return true if Text Auto-sizing layout algorithm is enabled
1078 * @hide
1079 */ 1119 */
1080 @CalledByNative 1120 @CalledByNative
1081 private boolean getTextAutosizingEnabledLocked() { 1121 private boolean getTextAutosizingEnabledLocked() {
1122 assert Thread.holdsLock(mAwSettingsLock);
1082 return mLayoutAlgorithm == LayoutAlgorithm.TEXT_AUTOSIZING; 1123 return mLayoutAlgorithm == LayoutAlgorithm.TEXT_AUTOSIZING;
1083 } 1124 }
1084 1125
1085 /** 1126 /**
1086 * See {@link android.webkit.WebSettings#setSupportMultipleWindows}. 1127 * See {@link android.webkit.WebSettings#setSupportMultipleWindows}.
1087 */ 1128 */
1088 public void setSupportMultipleWindows(boolean support) { 1129 public void setSupportMultipleWindows(boolean support) {
1089 synchronized (mAwSettingsLock) { 1130 synchronized (mAwSettingsLock) {
1090 if (mSupportMultipleWindows != support) { 1131 if (mSupportMultipleWindows != support) {
1091 mSupportMultipleWindows = support; 1132 mSupportMultipleWindows = support;
1092 mEventHandler.updateWebkitPreferencesLocked(); 1133 mEventHandler.updateWebkitPreferencesLocked();
1093 } 1134 }
1094 } 1135 }
1095 } 1136 }
1096 1137
1097 /** 1138 /**
1098 * See {@link android.webkit.WebSettings#supportMultipleWindows}. 1139 * See {@link android.webkit.WebSettings#supportMultipleWindows}.
1099 */ 1140 */
1100 public boolean supportMultipleWindows() { 1141 public boolean supportMultipleWindows() {
1101 synchronized (mAwSettingsLock) { 1142 synchronized (mAwSettingsLock) {
1102 return mSupportMultipleWindows; 1143 return mSupportMultipleWindows;
1103 } 1144 }
1104 } 1145 }
1105 1146
1106 @CalledByNative 1147 @CalledByNative
1107 private boolean getSupportMultipleWindowsLocked() { 1148 private boolean getSupportMultipleWindowsLocked() {
1149 assert Thread.holdsLock(mAwSettingsLock);
1108 return mSupportMultipleWindows; 1150 return mSupportMultipleWindows;
1109 } 1151 }
1110 1152
1111 @CalledByNative 1153 @CalledByNative
1112 private boolean getSupportLegacyQuirksLocked() { 1154 private boolean getSupportLegacyQuirksLocked() {
1155 assert Thread.holdsLock(mAwSettingsLock);
1113 return mSupportLegacyQuirks; 1156 return mSupportLegacyQuirks;
1114 } 1157 }
1115 1158
1116 /** 1159 /**
1117 * See {@link android.webkit.WebSettings#setUseWideViewPort}. 1160 * See {@link android.webkit.WebSettings#setUseWideViewPort}.
1118 */ 1161 */
1119 public void setUseWideViewPort(boolean use) { 1162 public void setUseWideViewPort(boolean use) {
1120 synchronized (mAwSettingsLock) { 1163 synchronized (mAwSettingsLock) {
1121 if (mUseWideViewport != use) { 1164 if (mUseWideViewport != use) {
1122 mUseWideViewport = use; 1165 mUseWideViewport = use;
1123 mEventHandler.updateWebkitPreferencesLocked(); 1166 mEventHandler.updateWebkitPreferencesLocked();
1124 } 1167 }
1125 } 1168 }
1126 } 1169 }
1127 1170
1128 /** 1171 /**
1129 * See {@link android.webkit.WebSettings#getUseWideViewPort}. 1172 * See {@link android.webkit.WebSettings#getUseWideViewPort}.
1130 */ 1173 */
1131 public boolean getUseWideViewPort() { 1174 public boolean getUseWideViewPort() {
1132 synchronized (mAwSettingsLock) { 1175 synchronized (mAwSettingsLock) {
1133 return mUseWideViewport; 1176 return mUseWideViewport;
1134 } 1177 }
1135 } 1178 }
1136 1179
1137 @CalledByNative 1180 @CalledByNative
1138 private boolean getUseWideViewportLocked() { 1181 private boolean getUseWideViewportLocked() {
1182 assert Thread.holdsLock(mAwSettingsLock);
1139 return mUseWideViewport; 1183 return mUseWideViewport;
1140 } 1184 }
1141 1185
1142 @CalledByNative 1186 @CalledByNative
1143 private boolean getPasswordEchoEnabledLocked() { 1187 private boolean getPasswordEchoEnabledLocked() {
1188 assert Thread.holdsLock(mAwSettingsLock);
1144 return mPasswordEchoEnabled; 1189 return mPasswordEchoEnabled;
1145 } 1190 }
1146 1191
1147 /** 1192 /**
1148 * See {@link android.webkit.WebSettings#setAppCacheEnabled}. 1193 * See {@link android.webkit.WebSettings#setAppCacheEnabled}.
1149 */ 1194 */
1150 public void setAppCacheEnabled(boolean flag) { 1195 public void setAppCacheEnabled(boolean flag) {
1151 synchronized (mAwSettingsLock) { 1196 synchronized (mAwSettingsLock) {
1152 if (mAppCacheEnabled != flag) { 1197 if (mAppCacheEnabled != flag) {
1153 mAppCacheEnabled = flag; 1198 mAppCacheEnabled = flag;
(...skipping 21 matching lines...) Expand all
1175 synchronized (mAwSettingsLock) { 1220 synchronized (mAwSettingsLock) {
1176 mEventHandler.updateWebkitPreferencesLocked(); 1221 mEventHandler.updateWebkitPreferencesLocked();
1177 } 1222 }
1178 } 1223 }
1179 } 1224 }
1180 1225
1181 /** 1226 /**
1182 * Gets whether Application Cache is enabled. 1227 * Gets whether Application Cache is enabled.
1183 * 1228 *
1184 * @return true if Application Cache is enabled 1229 * @return true if Application Cache is enabled
1185 * @hide
1186 */ 1230 */
1187 @CalledByNative 1231 @CalledByNative
1188 private boolean getAppCacheEnabledLocked() { 1232 private boolean getAppCacheEnabledLocked() {
1233 assert Thread.holdsLock(mAwSettingsLock);
1189 if (!mAppCacheEnabled) { 1234 if (!mAppCacheEnabled) {
1190 return false; 1235 return false;
1191 } 1236 }
1192 synchronized (sGlobalContentSettingsLock) { 1237 synchronized (sGlobalContentSettingsLock) {
1193 return sAppCachePathIsSet; 1238 return sAppCachePathIsSet;
1194 } 1239 }
1195 } 1240 }
1196 1241
1197 /** 1242 /**
1198 * See {@link android.webkit.WebSettings#setDomStorageEnabled}. 1243 * See {@link android.webkit.WebSettings#setDomStorageEnabled}.
(...skipping 11 matching lines...) Expand all
1210 * See {@link android.webkit.WebSettings#getDomStorageEnabled}. 1255 * See {@link android.webkit.WebSettings#getDomStorageEnabled}.
1211 */ 1256 */
1212 public boolean getDomStorageEnabled() { 1257 public boolean getDomStorageEnabled() {
1213 synchronized (mAwSettingsLock) { 1258 synchronized (mAwSettingsLock) {
1214 return mDomStorageEnabled; 1259 return mDomStorageEnabled;
1215 } 1260 }
1216 } 1261 }
1217 1262
1218 @CalledByNative 1263 @CalledByNative
1219 private boolean getDomStorageEnabledLocked() { 1264 private boolean getDomStorageEnabledLocked() {
1265 assert Thread.holdsLock(mAwSettingsLock);
1220 return mDomStorageEnabled; 1266 return mDomStorageEnabled;
1221 } 1267 }
1222 1268
1223 /** 1269 /**
1224 * See {@link android.webkit.WebSettings#setDatabaseEnabled}. 1270 * See {@link android.webkit.WebSettings#setDatabaseEnabled}.
1225 */ 1271 */
1226 public void setDatabaseEnabled(boolean flag) { 1272 public void setDatabaseEnabled(boolean flag) {
1227 synchronized (mAwSettingsLock) { 1273 synchronized (mAwSettingsLock) {
1228 if (mDatabaseEnabled != flag) { 1274 if (mDatabaseEnabled != flag) {
1229 mDatabaseEnabled = flag; 1275 mDatabaseEnabled = flag;
1230 mEventHandler.updateWebkitPreferencesLocked(); 1276 mEventHandler.updateWebkitPreferencesLocked();
1231 } 1277 }
1232 } 1278 }
1233 } 1279 }
1234 1280
1235 /** 1281 /**
1236 * See {@link android.webkit.WebSettings#getDatabaseEnabled}. 1282 * See {@link android.webkit.WebSettings#getDatabaseEnabled}.
1237 */ 1283 */
1238 public boolean getDatabaseEnabled() { 1284 public boolean getDatabaseEnabled() {
1239 synchronized (mAwSettingsLock) { 1285 synchronized (mAwSettingsLock) {
1240 return mDatabaseEnabled; 1286 return mDatabaseEnabled;
1241 } 1287 }
1242 } 1288 }
1243 1289
1244 @CalledByNative 1290 @CalledByNative
1245 private boolean getDatabaseEnabledLocked() { 1291 private boolean getDatabaseEnabledLocked() {
1292 assert Thread.holdsLock(mAwSettingsLock);
1246 return mDatabaseEnabled; 1293 return mDatabaseEnabled;
1247 } 1294 }
1248 1295
1249 /** 1296 /**
1250 * See {@link android.webkit.WebSettings#setDefaultTextEncodingName}. 1297 * See {@link android.webkit.WebSettings#setDefaultTextEncodingName}.
1251 */ 1298 */
1252 public void setDefaultTextEncodingName(String encoding) { 1299 public void setDefaultTextEncodingName(String encoding) {
1253 synchronized (mAwSettingsLock) { 1300 synchronized (mAwSettingsLock) {
1254 if (encoding != null && !mDefaultTextEncoding.equals(encoding)) { 1301 if (encoding != null && !mDefaultTextEncoding.equals(encoding)) {
1255 mDefaultTextEncoding = encoding; 1302 mDefaultTextEncoding = encoding;
1256 mEventHandler.updateWebkitPreferencesLocked(); 1303 mEventHandler.updateWebkitPreferencesLocked();
1257 } 1304 }
1258 } 1305 }
1259 } 1306 }
1260 1307
1261 /** 1308 /**
1262 * See {@link android.webkit.WebSettings#getDefaultTextEncodingName}. 1309 * See {@link android.webkit.WebSettings#getDefaultTextEncodingName}.
1263 */ 1310 */
1264 public String getDefaultTextEncodingName() { 1311 public String getDefaultTextEncodingName() {
1265 synchronized (mAwSettingsLock) { 1312 synchronized (mAwSettingsLock) {
1266 return mDefaultTextEncoding; 1313 return mDefaultTextEncoding;
1267 } 1314 }
1268 } 1315 }
1269 1316
1270 @CalledByNative 1317 @CalledByNative
1271 private String getDefaultTextEncodingLocked() { 1318 private String getDefaultTextEncodingLocked() {
1319 assert Thread.holdsLock(mAwSettingsLock);
1272 return mDefaultTextEncoding; 1320 return mDefaultTextEncoding;
1273 } 1321 }
1274 1322
1275 /** 1323 /**
1276 * See {@link android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture }. 1324 * See {@link android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture }.
1277 */ 1325 */
1278 public void setMediaPlaybackRequiresUserGesture(boolean require) { 1326 public void setMediaPlaybackRequiresUserGesture(boolean require) {
1279 synchronized (mAwSettingsLock) { 1327 synchronized (mAwSettingsLock) {
1280 if (mMediaPlaybackRequiresUserGesture != require) { 1328 if (mMediaPlaybackRequiresUserGesture != require) {
1281 mMediaPlaybackRequiresUserGesture = require; 1329 mMediaPlaybackRequiresUserGesture = require;
1282 mEventHandler.updateWebkitPreferencesLocked(); 1330 mEventHandler.updateWebkitPreferencesLocked();
1283 } 1331 }
1284 } 1332 }
1285 } 1333 }
1286 1334
1287 /** 1335 /**
1288 * See {@link android.webkit.WebSettings#getMediaPlaybackRequiresUserGesture }. 1336 * See {@link android.webkit.WebSettings#getMediaPlaybackRequiresUserGesture }.
1289 */ 1337 */
1290 public boolean getMediaPlaybackRequiresUserGesture() { 1338 public boolean getMediaPlaybackRequiresUserGesture() {
1291 synchronized (mAwSettingsLock) { 1339 synchronized (mAwSettingsLock) {
1292 return mMediaPlaybackRequiresUserGesture; 1340 return mMediaPlaybackRequiresUserGesture;
1293 } 1341 }
1294 } 1342 }
1295 1343
1296 @CalledByNative 1344 @CalledByNative
1297 private boolean getMediaPlaybackRequiresUserGestureLocked() { 1345 private boolean getMediaPlaybackRequiresUserGestureLocked() {
1346 assert Thread.holdsLock(mAwSettingsLock);
1298 return mMediaPlaybackRequiresUserGesture; 1347 return mMediaPlaybackRequiresUserGesture;
1299 } 1348 }
1300 1349
1301 /** 1350 /**
1302 * See {@link android.webkit.WebSettings#setDefaultVideoPosterURL}. 1351 * See {@link android.webkit.WebSettings#setDefaultVideoPosterURL}.
1303 */ 1352 */
1304 public void setDefaultVideoPosterURL(String url) { 1353 public void setDefaultVideoPosterURL(String url) {
1305 synchronized (mAwSettingsLock) { 1354 synchronized (mAwSettingsLock) {
1306 if (mDefaultVideoPosterURL != null && !mDefaultVideoPosterURL.equals (url) || 1355 if (mDefaultVideoPosterURL != null && !mDefaultVideoPosterURL.equals (url) ||
1307 mDefaultVideoPosterURL == null && url != null) { 1356 mDefaultVideoPosterURL == null && url != null) {
1308 mDefaultVideoPosterURL = url; 1357 mDefaultVideoPosterURL = url;
1309 mEventHandler.updateWebkitPreferencesLocked(); 1358 mEventHandler.updateWebkitPreferencesLocked();
1310 } 1359 }
1311 } 1360 }
1312 } 1361 }
1313 1362
1314 /** 1363 /**
1315 * See {@link android.webkit.WebSettings#getDefaultVideoPosterURL}. 1364 * See {@link android.webkit.WebSettings#getDefaultVideoPosterURL}.
1316 */ 1365 */
1317 public String getDefaultVideoPosterURL() { 1366 public String getDefaultVideoPosterURL() {
1318 synchronized (mAwSettingsLock) { 1367 synchronized (mAwSettingsLock) {
1319 return mDefaultVideoPosterURL; 1368 return mDefaultVideoPosterURL;
1320 } 1369 }
1321 } 1370 }
1322 1371
1323 @CalledByNative 1372 @CalledByNative
1324 private String getDefaultVideoPosterURLLocked() { 1373 private String getDefaultVideoPosterURLLocked() {
1374 assert Thread.holdsLock(mAwSettingsLock);
1325 return mDefaultVideoPosterURL; 1375 return mDefaultVideoPosterURL;
1326 } 1376 }
1327 1377
1328 private void onGestureZoomSupportChanged(final boolean supportsGestureZoom) { 1378 private void onGestureZoomSupportChanged(final boolean supportsGestureZoom) {
1329 // Always post asynchronously here, to avoid doubling back onto the call er. 1379 // Always post asynchronously here, to avoid doubling back onto the call er.
1330 mEventHandler.maybePostOnUiThread(new Runnable() { 1380 mEventHandler.maybePostOnUiThread(new Runnable() {
1331 @Override 1381 @Override
1332 public void run() { 1382 public void run() {
1333 synchronized (mAwSettingsLock) { 1383 synchronized (mAwSettingsLock) {
1334 if (mZoomChangeListener != null) { 1384 if (mZoomChangeListener != null) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 return size; 1475 return size;
1426 } 1476 }
1427 1477
1428 @CalledByNative 1478 @CalledByNative
1429 private void updateEverything() { 1479 private void updateEverything() {
1430 synchronized (mAwSettingsLock) { 1480 synchronized (mAwSettingsLock) {
1431 nativeUpdateEverythingLocked(mNativeAwSettings); 1481 nativeUpdateEverythingLocked(mNativeAwSettings);
1432 } 1482 }
1433 } 1483 }
1434 1484
1485 @CalledByNative
1486 private void populateWebPreferences(long webPrefsPtr) {
1487 synchronized (mAwSettingsLock) {
1488 nativePopulateWebPreferencesLocked(mNativeAwSettings, webPrefsPtr);
1489 }
1490 }
1491
1435 private void updateWebkitPreferencesOnUiThreadLocked() { 1492 private void updateWebkitPreferencesOnUiThreadLocked() {
1436 if (mNativeAwSettings != 0) { 1493 if (mNativeAwSettings != 0) {
1437 assert mEventHandler.mHandler != null; 1494 assert mEventHandler.mHandler != null;
1438 ThreadUtils.assertOnUiThread(); 1495 ThreadUtils.assertOnUiThread();
1439 nativeUpdateWebkitPreferencesLocked(mNativeAwSettings); 1496 nativeUpdateWebkitPreferencesLocked(mNativeAwSettings);
1440 } 1497 }
1441 } 1498 }
1442 1499
1443 private native long nativeInit(long webContentsPtr); 1500 private native long nativeInit(long webContentsPtr);
1444 1501
1445 private native void nativeDestroy(long nativeAwSettings); 1502 private native void nativeDestroy(long nativeAwSettings);
1446 1503
1504 private native void nativePopulateWebPreferencesLocked(long nativeAwSettings , long webPrefsPtr);
1505
1447 private native void nativeResetScrollAndScaleState(long nativeAwSettings); 1506 private native void nativeResetScrollAndScaleState(long nativeAwSettings);
1448 1507
1449 private native void nativeUpdateEverythingLocked(long nativeAwSettings); 1508 private native void nativeUpdateEverythingLocked(long nativeAwSettings);
1450 1509
1451 private native void nativeUpdateInitialPageScaleLocked(long nativeAwSettings ); 1510 private native void nativeUpdateInitialPageScaleLocked(long nativeAwSettings );
1452 1511
1453 private native void nativeUpdateUserAgentLocked(long nativeAwSettings); 1512 private native void nativeUpdateUserAgentLocked(long nativeAwSettings);
1454 1513
1455 private native void nativeUpdateWebkitPreferencesLocked(long nativeAwSetting s); 1514 private native void nativeUpdateWebkitPreferencesLocked(long nativeAwSetting s);
1456 1515
1457 private static native String nativeGetDefaultUserAgent(); 1516 private static native String nativeGetDefaultUserAgent();
1458 1517
1459 private native void nativeUpdateFormDataPreferencesLocked(long nativeAwSetti ngs); 1518 private native void nativeUpdateFormDataPreferencesLocked(long nativeAwSetti ngs);
1460 } 1519 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/native/aw_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698