summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 20:00:17 +0000
committererikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 20:00:17 +0000
commit72dfa077d95c8889cbb008fc14021d283bfeef6c (patch)
treeff519fdb0ee56707936be28402c289d31a4f0d07 /content/browser
parent8fed76e91b6c8406b30af0c0dbc01314cf2bd1db (diff)
downloadchromium_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 'content/browser')
-rw-r--r--content/browser/android/content_settings.cc2
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc5
-rw-r--r--content/browser/frame_host/interstitial_page_impl.cc4
-rw-r--r--content/browser/frame_host/interstitial_page_impl.h2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc2
-rw-r--r--content/browser/renderer_host/render_view_host_delegate.cc2
-rw-r--r--content/browser/renderer_host/render_view_host_delegate.h4
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc14
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h8
-rw-r--r--content/browser/web_contents/web_contents_impl.cc4
-rw-r--r--content/browser/web_contents/web_contents_impl.h2
11 files changed, 16 insertions, 33 deletions
diff --git a/content/browser/android/content_settings.cc b/content/browser/android/content_settings.cc
index 2d32143..7ab181b 100644
--- a/content/browser/android/content_settings.cc
+++ b/content/browser/android/content_settings.cc
@@ -39,7 +39,7 @@ bool ContentSettings::GetJavaScriptEnabled(JNIEnv* env, jobject obj) {
RenderViewHost* render_view_host = web_contents()->GetRenderViewHost();
if (!render_view_host)
return false;
- return render_view_host->GetWebkitPreferences().javascript_enabled;
+ return render_view_host->GetDelegate()->GetWebkitPrefs().javascript_enabled;
}
void ContentSettings::WebContentsDestroyed() {
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 1da2fdd..ef729e4 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -223,10 +223,7 @@ void BrowserPluginGuest::Initialize(
new BrowserPluginMsg_GuestContentWindowReady(instance_id_,
guest_routing_id));
- // TODO(chrishtr): this code is wrong. The navigate_on_drag_drop field will
- // be reset again the next time preferences are updated.
- WebPreferences prefs =
- GetWebContents()->GetRenderViewHost()->GetWebkitPreferences();
+ WebPreferences prefs = GetWebContents()->GetWebkitPrefs();
prefs.navigate_on_drag_drop = false;
GetWebContents()->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc
index f2cac9c..1a1ed43 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -509,11 +509,11 @@ RendererPreferences InterstitialPageImpl::GetRendererPrefs(
return renderer_preferences_;
}
-WebPreferences InterstitialPageImpl::ComputeWebkitPrefs() {
+WebPreferences InterstitialPageImpl::GetWebkitPrefs() {
if (!enabled())
return WebPreferences();
- return render_view_host_->ComputeWebkitPrefs(url_);
+ return render_view_host_->GetWebkitPrefs(url_);
}
void InterstitialPageImpl::RenderWidgetDeleted(
diff --git a/content/browser/frame_host/interstitial_page_impl.h b/content/browser/frame_host/interstitial_page_impl.h
index 1305eea..7f2d4d7 100644
--- a/content/browser/frame_host/interstitial_page_impl.h
+++ b/content/browser/frame_host/interstitial_page_impl.h
@@ -131,7 +131,7 @@ class CONTENT_EXPORT InterstitialPageImpl
int error_code) OVERRIDE;
virtual RendererPreferences GetRendererPrefs(
BrowserContext* browser_context) const OVERRIDE;
- virtual WebPreferences ComputeWebkitPrefs() OVERRIDE;
+ virtual WebPreferences GetWebkitPrefs() OVERRIDE;
virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
virtual void CreateNewWindow(
int render_process_id,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 86875b4..7218e14 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2123,7 +2123,7 @@ void RenderProcessHostImpl::OnGpuSwitching() {
continue;
RenderViewHost* rvh = RenderViewHost::From(widget);
- rvh->OnWebkitPreferencesChanged();
+ rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences());
}
}
diff --git a/content/browser/renderer_host/render_view_host_delegate.cc b/content/browser/renderer_host/render_view_host_delegate.cc
index 41a110e..9c0f17f 100644
--- a/content/browser/renderer_host/render_view_host_delegate.cc
+++ b/content/browser/renderer_host/render_view_host_delegate.cc
@@ -22,7 +22,7 @@ WebContents* RenderViewHostDelegate::GetAsWebContents() {
return NULL;
}
-WebPreferences RenderViewHostDelegate::ComputeWebkitPrefs() {
+WebPreferences RenderViewHostDelegate::GetWebkitPrefs() {
return WebPreferences();
}
diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h
index 8c453a3..4a44123 100644
--- a/content/browser/renderer_host/render_view_host_delegate.h
+++ b/content/browser/renderer_host/render_view_host_delegate.h
@@ -139,9 +139,9 @@ class CONTENT_EXPORT RenderViewHostDelegate {
virtual RendererPreferences GetRendererPrefs(
BrowserContext* browser_context) const = 0;
- // Computes a WebPreferences object that will be used by the renderer
+ // Returns a WebPreferences object that will be used by the renderer
// associated with the owning render view host.
- virtual WebPreferences ComputeWebkitPrefs();
+ virtual WebPreferences GetWebkitPrefs();
// Notification the user has made a gesture while focus was on the
// page. This is used to avoid uninitiated user downloads (aka carpet
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 06b993c..0be391e 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -289,7 +289,7 @@ bool RenderViewHostImpl::CreateRenderView(
ViewMsg_New_Params params;
params.renderer_preferences =
delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext());
- params.web_preferences = GetWebkitPreferences();
+ params.web_preferences = delegate_->GetWebkitPrefs();
params.view_id = GetRoutingID();
params.main_frame_routing_id = main_frame_routing_id_;
params.surface_id = surface_id();
@@ -329,7 +329,7 @@ void RenderViewHostImpl::SyncRendererPrefs() {
GetProcess()->GetBrowserContext())));
}
-WebPreferences RenderViewHostImpl::ComputeWebkitPrefs(const GURL& url) {
+WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) {
TRACE_EVENT0("browser", "RenderViewHostImpl::GetWebkitPrefs");
WebPreferences prefs;
@@ -1418,10 +1418,7 @@ void RenderViewHostImpl::ExitFullscreen() {
}
WebPreferences RenderViewHostImpl::GetWebkitPreferences() {
- if (!web_preferences_.get()) {
- OnWebkitPreferencesChanged();
- }
- return *web_preferences_;
+ return delegate_->GetWebkitPrefs();
}
void RenderViewHostImpl::DisownOpener() {
@@ -1432,14 +1429,9 @@ void RenderViewHostImpl::DisownOpener() {
}
void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) {
- web_preferences_.reset(new WebPreferences(prefs));
Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
}
-void RenderViewHostImpl::OnWebkitPreferencesChanged() {
- UpdateWebkitPreferences(delegate_->ComputeWebkitPrefs());
-}
-
void RenderViewHostImpl::GetAudioOutputControllers(
const GetAudioOutputControllersCallback& callback) const {
AudioRendererHost* audio_host =
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 250204e..e2a9764 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -204,7 +204,6 @@ class CONTENT_EXPORT RenderViewHostImpl
virtual WebPreferences GetWebkitPreferences() OVERRIDE;
virtual void UpdateWebkitPreferences(
const WebPreferences& prefs) OVERRIDE;
- virtual void OnWebkitPreferencesChanged() OVERRIDE;
virtual void GetAudioOutputControllers(
const GetAudioOutputControllersCallback& callback) const OVERRIDE;
virtual void SelectWordAroundCaret() OVERRIDE;
@@ -242,7 +241,7 @@ class CONTENT_EXPORT RenderViewHostImpl
}
// Returns the content specific prefs for this RenderViewHost.
- WebPreferences ComputeWebkitPrefs(const GURL& url);
+ WebPreferences GetWebkitPrefs(const GURL& url);
// Sends the given navigation message. Use this rather than sending it
// yourself since this does the internal bookkeeping described below. This
@@ -608,11 +607,6 @@ class CONTENT_EXPORT RenderViewHostImpl
// True if the current focused element is editable.
bool is_focused_element_editable_;
- // This is updated every time UpdateWebkitPreferences is called. That method
- // is in turn called when any of the settings change that the WebPreferences
- // values depend on.
- scoped_ptr<WebPreferences> web_preferences_;
-
DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
};
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a0bf9b3..9c40100 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3846,7 +3846,7 @@ bool WebContentsImpl::AddMessageToConsole(int32 level,
source_id);
}
-WebPreferences WebContentsImpl::ComputeWebkitPrefs() {
+WebPreferences WebContentsImpl::GetWebkitPrefs() {
// We want to base the page config off of the actual URL, rather than the
// virtual URL.
// TODO(nasko): Investigate how to remove the GetActiveEntry usage here,
@@ -3854,7 +3854,7 @@ WebPreferences WebContentsImpl::ComputeWebkitPrefs() {
GURL url = controller_.GetActiveEntry()
? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL();
- return GetRenderManager()->current_host()->ComputeWebkitPrefs(url);
+ return GetRenderManager()->current_host()->GetWebkitPrefs(url);
}
int WebContentsImpl::CreateSwappedOutRenderView(
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index fd69e98..aee4309 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -417,7 +417,7 @@ class CONTENT_EXPORT WebContentsImpl
const base::string16& source_id) OVERRIDE;
virtual RendererPreferences GetRendererPrefs(
BrowserContext* browser_context) const OVERRIDE;
- virtual WebPreferences ComputeWebkitPrefs() OVERRIDE;
+ virtual WebPreferences GetWebkitPrefs() OVERRIDE;
virtual void OnUserGesture() OVERRIDE;
virtual void OnIgnoredUIEvent() OVERRIDE;
virtual void RendererUnresponsive(RenderViewHost* render_view_host,