diff options
author | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 20:00:17 +0000 |
---|---|---|
committer | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 20:00:17 +0000 |
commit | 72dfa077d95c8889cbb008fc14021d283bfeef6c (patch) | |
tree | ff519fdb0ee56707936be28402c289d31a4f0d07 /chrome/browser | |
parent | 8fed76e91b6c8406b30af0c0dbc01314cf2bd1db (diff) | |
download | chromium_src-72dfa077d95c8889cbb008fc14021d283bfeef6c.zip chromium_src-72dfa077d95c8889cbb008fc14021d283bfeef6c.tar.gz chromium_src-72dfa077d95c8889cbb008fc14021d283bfeef6c.tar.bz2 |
Revert of Cache the current WebPreferences on RenderViewHostImpl. (https://codereview.chromium.org/373323003/)
Reason for revert:
Causes DOA on 38-dev.
https://code.google.com/p/chromium/issues/detail?id=398751
Original issue's description:
> Cache the current WebPreferences on RenderViewHostImpl.
>
> This makes lookups of a WebPreferences field fast.
> In order do this, add code to listen to all preferences updates in order to recompute the cache.
>
> BUG=390799
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284592
TBR=jam, michaelbai, chrishtr, avi
NOTREECHECKS=true
NOTRY=true
BUG=390799
Review URL: https://codereview.chromium.org/429413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/android/voice_search_tab_helper.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/chrome_pref_service_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/printing/print_dialog_cloud.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/prefs/prefs_tab_helper.cc | 26 | ||||
-rw-r--r-- | chrome/browser/ui/prefs/prefs_tab_helper.h | 2 |
6 files changed, 9 insertions, 27 deletions
diff --git a/chrome/browser/android/voice_search_tab_helper.cc b/chrome/browser/android/voice_search_tab_helper.cc index 52f0c36..c8f10db 100644 --- a/chrome/browser/android/voice_search_tab_helper.cc +++ b/chrome/browser/android/voice_search_tab_helper.cc @@ -32,8 +32,6 @@ static void UpdateAutoplayStatus(JNIEnv* env, if (!prefs.user_gesture_required_for_media_playback) return; - // TODO(chrishtr): this is wrong. user_gesture_required_for_media_playback - // will be reset the next time a preference changes. prefs.user_gesture_required_for_media_playback = !google_util::IsGoogleSearchUrl(web_contents->GetLastCommittedURL()); host->UpdateWebkitPreferences(prefs); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 8a174a6..87b4810 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -2524,8 +2524,6 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( } DCHECK(!web_prefs->default_encoding.empty()); - // Note: it's not posible for kExtensionsScheme to change during the lifetime - // of the process. WebContents* web_contents = WebContents::FromRenderViewHost(rvh); extensions::ViewType view_type = extensions::GetViewType(web_contents); ExtensionService* service = diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc index 4b64946..67a77a4 100644 --- a/chrome/browser/prefs/chrome_pref_service_unittest.cc +++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc @@ -117,7 +117,7 @@ class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { // to a WebPreferences object. TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { WebPreferences webkit_prefs = - WebContentsTester::For(web_contents())->TestComputeWebkitPrefs(); + WebContentsTester::For(web_contents())->TestGetWebkitPrefs(); // These values have been overridden by the profile preferences. EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 44e6c6d..bf08701 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -361,8 +361,6 @@ void CloudPrintFlowHandler::Observe( // script permissions required for the web UI. RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost(); if (rvh) { - // TODO(chrishtr): this is wrong. allow_scripts_to_close_windows will - // be reset the next time a preference changes. WebPreferences webkit_prefs = rvh->GetWebkitPreferences(); webkit_prefs.allow_scripts_to_close_windows = true; rvh->UpdateWebkitPreferences(webkit_prefs); diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index bc9b08a..0079bf9 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -49,31 +49,23 @@ namespace { // The list of prefs we want to observe. const char* kPrefsToObserve[] = { prefs::kDefaultCharset, - prefs::kDisable3DAPIs, - prefs::kEnableHyperlinkAuditing, prefs::kWebKitAllowDisplayingInsecureContent, prefs::kWebKitAllowRunningInsecureContent, prefs::kWebKitDefaultFixedFontSize, prefs::kWebKitDefaultFontSize, - prefs::kWebKitDomPasteEnabled, #if defined(OS_ANDROID) prefs::kWebKitFontScaleFactor, prefs::kWebKitForceEnableZoom, prefs::kWebKitPasswordEchoEnabled, #endif - prefs::kWebKitInspectorSettings, - prefs::kWebKitJavascriptCanOpenWindowsAutomatically, prefs::kWebKitJavascriptEnabled, prefs::kWebKitJavaEnabled, prefs::kWebKitLoadsImagesAutomatically, prefs::kWebKitMinimumFontSize, prefs::kWebKitMinimumLogicalFontSize, prefs::kWebKitPluginsEnabled, - prefs::kWebKitShrinksStandaloneImagesToFit, prefs::kWebkitTabsToLinks, - prefs::kWebKitTextAreasAreResizable, - prefs::kWebKitUsesUniversalDetector, - prefs::kWebKitWebSecurityEnabled, + prefs::kWebKitUsesUniversalDetector }; const int kPrefsToObserveLength = arraysize(kPrefsToObserve); @@ -120,7 +112,6 @@ ALL_FONT_SCRIPTS(WEBKIT_WEBPREFS_FONTS_STANDARD) } } } -#endif // !defined(OS_ANDROID) // Registers |obs| to observe per-script font prefs under the path |map_name|. // On android, there's no exposed way to change these prefs, so we can save @@ -137,6 +128,7 @@ void RegisterFontFamilyMapObserver( registrar->Add(pref_name.c_str(), obs); } } +#endif // !defined(OS_ANDROID) #if defined(OS_WIN) // On Windows with antialising we want to use an alternate fixed font like @@ -334,9 +326,12 @@ PrefsTabHelper::PrefsTabHelper(WebContents* contents) &PrefsTabHelper::OnWebPrefChanged, base::Unretained(this)); for (int i = 0; i < kPrefsToObserveLength; ++i) { const char* pref_name = kPrefsToObserve[i]; + DCHECK(std::string(pref_name) == prefs::kDefaultCharset || + StartsWithASCII(pref_name, "webkit.webprefs.", true)); pref_change_registrar_.Add(pref_name, webkit_callback); } +#if !defined(OS_ANDROID) RegisterFontFamilyMapObserver(&pref_change_registrar_, prefs::kWebKitStandardFontFamilyMap, webkit_callback); @@ -358,6 +353,7 @@ PrefsTabHelper::PrefsTabHelper(WebContents* contents) RegisterFontFamilyMapObserver(&pref_change_registrar_, prefs::kWebKitPictographFontFamilyMap, webkit_callback); +#endif // !defined(OS_ANDROID) } renderer_preferences_util::UpdateFromSystemSettings( @@ -580,7 +576,7 @@ Profile* PrefsTabHelper::GetProfile() { return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); } -void PrefsTabHelper::OnFontFamilyPrefChanged(const std::string& pref_name) { +void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { // When a font family pref's value goes from non-empty to the empty string, we // must add it to the usual WebPreferences struct passed to the renderer. // @@ -608,12 +604,6 @@ void PrefsTabHelper::OnFontFamilyPrefChanged(const std::string& pref_name) { return; } } -} - -void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { -#if !defined(OS_ANDROID) - OnFontFamilyPrefChanged(pref_name); -#endif - web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); + UpdateWebPreferences(); } diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h index f97410d..055a2f1 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.h +++ b/chrome/browser/ui/prefs/prefs_tab_helper.h @@ -51,8 +51,6 @@ class PrefsTabHelper : public content::NotificationObserver, void UpdateRendererPreferences(); Profile* GetProfile(); - - void OnFontFamilyPrefChanged(const std::string& pref_name); void OnWebPrefChanged(const std::string& pref_name); content::WebContents* web_contents_; |