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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 286943005: Reducing CPU cycles of hidden/minimized browser windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved to WebContentsViewAura 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 | « content/browser/web_contents/web_contents_view_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index f134da3b24a005846f9d5709db22112628a86698..351b4297dd835efee579950fffc2fe110f3c6242 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -721,6 +721,7 @@ WebContentsViewAura::~WebContentsViewAura() {
// Window needs a valid delegate during its destructor, so we explicitly
// delete it here.
+ window_->RemoveObserver(this);
window_.reset();
}
@@ -1045,6 +1046,7 @@ void WebContentsViewAura::CreateView(
window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
window_->SetTransparent(false);
window_->Init(aura::WINDOW_LAYER_NOT_DRAWN);
+ window_->AddObserver(this);
aura::Window* root_window = context ? context->GetRootWindow() : NULL;
if (root_window) {
// There are places where there is no context currently because object
@@ -1555,4 +1557,26 @@ int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) {
return ConvertFromWeb(current_drag_op_);
}
+void WebContentsViewAura::OnWindowParentChanged(aura::Window* window,
+ aura::Window* parent) {
+ if (!parent || parent->IsVisible())
sky 2014/05/16 20:14:58 I don't get why you're tracking visibility of the
+ web_contents_->WasShown();
+ else
+ web_contents_->WasHidden();
+}
+
+void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
+ bool visible) {
+ aura::Window* parent = window_->parent();
+ if (!parent)
+ return;
+
+ // Follow the visibility of the parent window since e.g. navigation
+ // operations could otherwise cause a flash.
+ if (parent->IsVisible())
+ web_contents_->WasShown();
+ else
+ web_contents_->WasHidden();
+}
+
} // namespace content
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698