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

Unified Diff: ui/views/controls/native/native_view_host_aura.cc

Issue 286943005: Reducing CPU cycles of hidden/minimized browser windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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 | « ui/views/controls/native/native_view_host_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/native/native_view_host_aura.cc
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc
index 49bf733bbe2ae06567f1b9d148db2255b743ab85..2b0b41d1c98e4edc95c7dd7d460023be8c86353b 100644
--- a/ui/views/controls/native/native_view_host_aura.cc
+++ b/ui/views/controls/native/native_view_host_aura.cc
@@ -112,6 +112,25 @@ void NativeViewHostAura::OnWindowDestroyed(aura::Window* window) {
host_->NativeViewDestroyed();
}
+void NativeViewHostAura::OnWindowVisibilityChanged(aura::Window* window,
sky 2014/05/15 22:42:19 Again, I think this should be done at the content
+ bool is_visible) {
+ // To reduce background activity of minimized / non visible browser content,
+ // we let the native view follow its parent's visibility which will suppress
+ // further renderer updates.
+ // Note: In case of browser navigations, the window visibility will change to
+ // invisible as well and cause long "flashes". By following the parent's
+ // windows visibility, we only suppress rendering in case of minimizing /
+ // general invisibility.
+ if (host_->native_view() &&
+ host_->native_view()->parent() &&
+ is_visible == host_->native_view()->parent()->IsVisible()) {
+ if (is_visible)
+ host_->native_view()->Show();
+ else
+ host_->native_view()->Hide();
+ }
+}
+
// static
NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper(
NativeViewHost* host) {
« no previous file with comments | « ui/views/controls/native/native_view_host_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698