summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 18:11:39 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 18:11:39 +0000
commit770dd8b8b1ee5adc67ed257e53d3f34c7e67b02e (patch)
treee0894895aa1152dd152459657f4e0de497195d51 /chrome/browser
parentd5fa6fd614049dcacb22ab9034eaf2b892a17e85 (diff)
downloadchromium_src-770dd8b8b1ee5adc67ed257e53d3f34c7e67b02e.zip
chromium_src-770dd8b8b1ee5adc67ed257e53d3f34c7e67b02e.tar.gz
chromium_src-770dd8b8b1ee5adc67ed257e53d3f34c7e67b02e.tar.bz2
Mac: Fix renderer idle cpu usage regression.
Since polling is required only for the preferred height and mac only needs preferred width, add a flag that specifies if the client is interested in width and/or height. This is a band-aid, the Real Fix is tracked in 44850. BUG=44494 TEST=Open chrome's task manager. Idle renderer processes should take close to 0 %cpu instead of ~1.5 before. Review URL: http://codereview.chromium.org/2145002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_host.cc3
-rw-r--r--chrome/browser/notifications/balloon_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.h6
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc6
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm8
6 files changed, 19 insertions, 12 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 1ae5aca..1a98b0d 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -712,7 +712,8 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
extension_host_type_ == ViewType::EXTENSION_MOLE ||
extension_host_type_ == ViewType::EXTENSION_POPUP ||
extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
- render_view_host->EnablePreferredSizeChangedMode();
+ render_view_host->EnablePreferredSizeChangedMode(
+ kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
}
}
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index 3dbefdc..56c6b93 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -15,6 +15,7 @@
#include "chrome/common/bindings_policy.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
+#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_preferences.h"
#include "chrome/common/url_constants.h"
@@ -57,7 +58,8 @@ void BalloonHost::Close(RenderViewHost* render_view_host) {
}
void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) {
- render_view_host->EnablePreferredSizeChangedMode();
+ render_view_host->EnablePreferredSizeChangedMode(
+ kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
}
void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) {
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index c807f73..7d5a58a 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1816,8 +1816,8 @@ void RenderViewHost::SendContentSettings(const GURL& url,
Send(new ViewMsg_SetContentSettingsForCurrentURL(url, settings));
}
-void RenderViewHost::EnablePreferredSizeChangedMode() {
- Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id()));
+void RenderViewHost::EnablePreferredSizeChangedMode(int flags) {
+ Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id(), flags));
}
void RenderViewHost::OnExtensionPostMessage(
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 97467f4..cd97788 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -462,8 +462,10 @@ class RenderViewHost : public RenderWidgetHost {
const ContentSettings& settings);
// Tells the renderer to notify us when the page contents preferred size
- // changed.
- void EnablePreferredSizeChangedMode();
+ // changed. |flags| is a combination of
+ // |ViewHostMsg_EnablePreferredSizeChangedMode_Flags| values, which is defined
+ // in render_messages.h.
+ void EnablePreferredSizeChangedMode(int flags);
protected:
// RenderWidgetHost protected overrides.
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 3e38fe0..f3160cc 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -789,8 +789,10 @@ bool TabContents::NavigateToPendingEntry(
if (!dest_render_view_host)
return false; // Unable to create the desired render view host.
- if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications())
- dest_render_view_host->EnablePreferredSizeChangedMode();
+ if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications()) {
+ dest_render_view_host->EnablePreferredSizeChangedMode(
+ kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
+ }
// For security, we should never send non-DOM-UI URLs (other than about:blank)
// to a DOM UI renderer. Double check that here.
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 92cbe2d..9de79b9 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -154,10 +154,10 @@ void TabContentsViewMac::StartDragging(
}
void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) {
- // We want updates whenever the intrinsic width of the webpage
- // changes. Put the RenderView into that mode.
- int routing_id = host->routing_id();
- host->Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id));
+ // We want updates whenever the intrinsic width of the webpage changes.
+ // Put the RenderView into that mode. The preferred width is used for example
+ // when the "zoom" button in the browser window is clicked.
+ host->EnablePreferredSizeChangedMode(kPreferredSizeWidth);
}
void TabContentsViewMac::SetPageTitle(const std::wstring& title) {