diff options
author | jbauman <jbauman@chromium.org> | 2015-06-03 19:23:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-04 02:23:51 +0000 |
commit | 8da589acbe17b327b69abbece0c1c36a1a3b1f65 (patch) | |
tree | 0cb33611306faa3cbe69d9d8fe9c50d3784cb2aa | |
parent | 613559e5bc149bf560e5422c31e17f1932e9baf6 (diff) | |
download | chromium_src-8da589acbe17b327b69abbece0c1c36a1a3b1f65.zip chromium_src-8da589acbe17b327b69abbece0c1c36a1a3b1f65.tar.gz chromium_src-8da589acbe17b327b69abbece0c1c36a1a3b1f65.tar.bz2 |
Hide compositor when DesktopWindowTreeHostWin::Hide is called.
This avoids trying to draw hidden windows and improves performance of resize because status bubble isn't continually redrawn.
Review URL: https://codereview.chromium.org/1157433008
Cr-Commit-Position: refs/heads/master@{#332768}
-rw-r--r-- | ash/host/ash_window_tree_host_unified.cc | 4 | ||||
-rw-r--r-- | ash/host/ash_window_tree_host_unified.h | 4 | ||||
-rw-r--r-- | mandoline/ui/aura/window_tree_host_mojo.cc | 4 | ||||
-rw-r--r-- | mandoline/ui/aura/window_tree_host_mojo.h | 4 | ||||
-rw-r--r-- | ui/aura/remote_window_tree_host_win.cc | 4 | ||||
-rw-r--r-- | ui/aura/remote_window_tree_host_win.h | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host.cc | 12 | ||||
-rw-r--r-- | ui/aura/window_tree_host.h | 10 | ||||
-rw-r--r-- | ui/aura/window_tree_host_mac.mm | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_ozone.cc | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_ozone.h | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_win.cc | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_win.h | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_x11.cc | 4 | ||||
-rw-r--r-- | ui/aura/window_tree_host_x11.h | 4 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc | 13 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_win.h | 4 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc | 6 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h | 4 |
19 files changed, 64 insertions, 37 deletions
diff --git a/ash/host/ash_window_tree_host_unified.cc b/ash/host/ash_window_tree_host_unified.cc index b36223f..2e9db76 100644 --- a/ash/host/ash_window_tree_host_unified.cc +++ b/ash/host/ash_window_tree_host_unified.cc @@ -110,10 +110,10 @@ gfx::AcceleratedWidget AshWindowTreeHostUnified::GetAcceleratedWidget() { return gfx::kNullAcceleratedWidget; } -void AshWindowTreeHostUnified::Show() { +void AshWindowTreeHostUnified::ShowImpl() { } -void AshWindowTreeHostUnified::Hide() { +void AshWindowTreeHostUnified::HideImpl() { } gfx::Rect AshWindowTreeHostUnified::GetBounds() const { diff --git a/ash/host/ash_window_tree_host_unified.h b/ash/host/ash_window_tree_host_unified.h index aa9ab4c..843ff03 100644 --- a/ash/host/ash_window_tree_host_unified.h +++ b/ash/host/ash_window_tree_host_unified.h @@ -47,8 +47,8 @@ class AshWindowTreeHostUnified : public AshWindowTreeHost, // aura::WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Transform GetRootTransform() const override; diff --git a/mandoline/ui/aura/window_tree_host_mojo.cc b/mandoline/ui/aura/window_tree_host_mojo.cc index 293025d..1cd7a53 100644 --- a/mandoline/ui/aura/window_tree_host_mojo.cc +++ b/mandoline/ui/aura/window_tree_host_mojo.cc @@ -52,11 +52,11 @@ gfx::AcceleratedWidget WindowTreeHostMojo::GetAcceleratedWidget() { return gfx::kNullAcceleratedWidget; } -void WindowTreeHostMojo::Show() { +void WindowTreeHostMojo::ShowImpl() { window()->Show(); } -void WindowTreeHostMojo::Hide() { +void WindowTreeHostMojo::HideImpl() { } gfx::Rect WindowTreeHostMojo::GetBounds() const { diff --git a/mandoline/ui/aura/window_tree_host_mojo.h b/mandoline/ui/aura/window_tree_host_mojo.h index ba38f51..3fb2769 100644 --- a/mandoline/ui/aura/window_tree_host_mojo.h +++ b/mandoline/ui/aura/window_tree_host_mojo.h @@ -42,8 +42,8 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, // WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/aura/remote_window_tree_host_win.cc b/ui/aura/remote_window_tree_host_win.cc index c44234c..8ffa617 100644 --- a/ui/aura/remote_window_tree_host_win.cc +++ b/ui/aura/remote_window_tree_host_win.cc @@ -205,14 +205,14 @@ gfx::AcceleratedWidget RemoteWindowTreeHostWin::GetAcceleratedWidget() { return ::GetDesktopWindow(); } -void RemoteWindowTreeHostWin::Show() { +void RemoteWindowTreeHostWin::ShowImpl() { ui::RemoteInputMethodPrivateWin* remote_input_method_private = GetRemoteInputMethodPrivate(); if (remote_input_method_private) remote_input_method_private->SetRemoteDelegate(this); } -void RemoteWindowTreeHostWin::Hide() { +void RemoteWindowTreeHostWin::HideImpl() { NOTIMPLEMENTED(); } diff --git a/ui/aura/remote_window_tree_host_win.h b/ui/aura/remote_window_tree_host_win.h index 4cde32c..5db2b47 100644 --- a/ui/aura/remote_window_tree_host_win.h +++ b/ui/aura/remote_window_tree_host_win.h @@ -118,8 +118,8 @@ class AURA_EXPORT RemoteWindowTreeHostWin // WindowTreeHost overrides: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index e60208b..772b020 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc @@ -172,6 +172,18 @@ void WindowTreeHost::MoveCursorToHostLocation(const gfx::Point& host_location) { MoveCursorToInternal(root_location, host_location); } +void WindowTreeHost::Show() { + if (compositor()) + compositor()->SetVisible(true); + ShowImpl(); +} + +void WindowTreeHost::Hide() { + HideImpl(); + if (compositor()) + compositor()->SetVisible(false); +} + //////////////////////////////////////////////////////////////////////////////// // WindowTreeHost, protected: diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index f4dc23e..27b104c 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h @@ -124,10 +124,10 @@ class AURA_EXPORT WindowTreeHost { virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; // Shows the WindowTreeHost. - virtual void Show() = 0; + void Show(); // Hides the WindowTreeHost. - virtual void Hide() = 0; + void Hide(); // Gets/Sets the size of the WindowTreeHost (in pixels). virtual gfx::Rect GetBounds() const = 0; @@ -166,6 +166,12 @@ class AURA_EXPORT WindowTreeHost { // kCalled when the cursor visibility has changed. virtual void OnCursorVisibilityChangedNative(bool show) = 0; + // Shows the WindowTreeHost. + virtual void ShowImpl() = 0; + + // Hides the WindowTreeHost. + virtual void HideImpl() = 0; + private: friend class test::WindowTreeHostTestApi; diff --git a/ui/aura/window_tree_host_mac.mm b/ui/aura/window_tree_host_mac.mm index 350fca6..b177d70 100644 --- a/ui/aura/window_tree_host_mac.mm +++ b/ui/aura/window_tree_host_mac.mm @@ -31,11 +31,11 @@ EventSource* WindowTreeHostMac::GetEventSource() { gfx::AcceleratedWidget WindowTreeHostMac::GetAcceleratedWidget() { return [window_ contentView]; } -void WindowTreeHostMac::Show() { +void WindowTreeHostMac::ShowImpl() { [window_ makeKeyAndOrderFront:nil]; } -void WindowTreeHostMac::Hide() { +void WindowTreeHostMac::HideImpl() { [window_ orderOut:nil]; } diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc index 1559c24..a4287f8 100644 --- a/ui/aura/window_tree_host_ozone.cc +++ b/ui/aura/window_tree_host_ozone.cc @@ -30,11 +30,11 @@ gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { return widget_; } -void WindowTreeHostOzone::Show() { +void WindowTreeHostOzone::ShowImpl() { platform_window_->Show(); } -void WindowTreeHostOzone::Hide() { +void WindowTreeHostOzone::HideImpl() { platform_window_->Hide(); } diff --git a/ui/aura/window_tree_host_ozone.h b/ui/aura/window_tree_host_ozone.h index e4fcd02..e771109 100644 --- a/ui/aura/window_tree_host_ozone.h +++ b/ui/aura/window_tree_host_ozone.h @@ -28,8 +28,8 @@ class AURA_EXPORT WindowTreeHostOzone : public WindowTreeHost, // WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/aura/window_tree_host_win.cc b/ui/aura/window_tree_host_win.cc index f046c20..5e18833 100644 --- a/ui/aura/window_tree_host_win.cc +++ b/ui/aura/window_tree_host_win.cc @@ -62,11 +62,11 @@ gfx::AcceleratedWidget WindowTreeHostWin::GetAcceleratedWidget() { return widget_; } -void WindowTreeHostWin::Show() { +void WindowTreeHostWin::ShowImpl() { window_->Show(); } -void WindowTreeHostWin::Hide() { +void WindowTreeHostWin::HideImpl() { window_->Hide(); } diff --git a/ui/aura/window_tree_host_win.h b/ui/aura/window_tree_host_win.h index 8399c8e..f0fc384 100644 --- a/ui/aura/window_tree_host_win.h +++ b/ui/aura/window_tree_host_win.h @@ -26,8 +26,8 @@ class AURA_EXPORT WindowTreeHostWin // WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index 0fb463e..9eb8592 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc @@ -456,7 +456,7 @@ gfx::AcceleratedWidget WindowTreeHostX11::GetAcceleratedWidget() { return xwindow_; } -void WindowTreeHostX11::Show() { +void WindowTreeHostX11::ShowImpl() { if (!window_mapped_) { // Before we map the window, set size hints. Otherwise, some window managers // will ignore toplevel XMoveWindow commands. @@ -480,7 +480,7 @@ void WindowTreeHostX11::Show() { } } -void WindowTreeHostX11::Hide() { +void WindowTreeHostX11::HideImpl() { if (window_mapped_) { XWithdrawWindow(xdisplay_, xwindow_, 0); window_mapped_ = false; diff --git a/ui/aura/window_tree_host_x11.h b/ui/aura/window_tree_host_x11.h index a37f89c..56b900d 100644 --- a/ui/aura/window_tree_host_x11.h +++ b/ui/aura/window_tree_host_x11.h @@ -44,8 +44,8 @@ class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, // WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 0807934..a927a48 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -207,11 +207,15 @@ aura::WindowTreeHost* DesktopWindowTreeHostWin::AsWindowTreeHost() { void DesktopWindowTreeHostWin::ShowWindowWithState( ui::WindowShowState show_state) { + if (compositor()) + compositor()->SetVisible(true); message_handler_->ShowWindowWithState(show_state); } void DesktopWindowTreeHostWin::ShowMaximizedWithBounds( const gfx::Rect& restored_bounds) { + if (compositor()) + compositor()->SetVisible(true); gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(restored_bounds); message_handler_->ShowMaximizedWithBounds(pixel_bounds); } @@ -410,8 +414,11 @@ void DesktopWindowTreeHostWin::SetFullscreen(bool fullscreen) { // TODO(sky): workaround for ScopedFullscreenVisibility showing window // directly. Instead of this should listen for visibility changes and then // update window. - if (message_handler_->IsVisible() && !content_window_->TargetVisibility()) + if (message_handler_->IsVisible() && !content_window_->TargetVisibility()) { + if (compositor()) + compositor()->SetVisible(true); content_window_->Show(); + } SetWindowTransparency(); } @@ -469,11 +476,11 @@ gfx::AcceleratedWidget DesktopWindowTreeHostWin::GetAcceleratedWidget() { return message_handler_->hwnd(); } -void DesktopWindowTreeHostWin::Show() { +void DesktopWindowTreeHostWin::ShowImpl() { message_handler_->Show(); } -void DesktopWindowTreeHostWin::Hide() { +void DesktopWindowTreeHostWin::HideImpl() { if (!pending_close_) message_handler_->Hide(); } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index 0338a46..dc9f1be 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -107,8 +107,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin // Overridden from aura::WindowTreeHost: ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; gfx::Point GetLocationOnNativeScreen() const override; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 69c5b2f..4a8f64c 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -365,6 +365,8 @@ aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { void DesktopWindowTreeHostX11::ShowWindowWithState( ui::WindowShowState show_state) { + if (compositor()) + compositor()->SetVisible(true); if (!window_mapped_) MapWindow(show_state); @@ -890,12 +892,12 @@ gfx::AcceleratedWidget DesktopWindowTreeHostX11::GetAcceleratedWidget() { return xwindow_; } -void DesktopWindowTreeHostX11::Show() { +void DesktopWindowTreeHostX11::ShowImpl() { ShowWindowWithState(ui::SHOW_STATE_NORMAL); native_widget_delegate_->OnNativeWidgetVisibilityChanged(true); } -void DesktopWindowTreeHostX11::Hide() { +void DesktopWindowTreeHostX11::HideImpl() { if (window_mapped_) { XWithdrawWindow(xdisplay_, xwindow_, 0); window_mapped_ = false; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h index b726445..e2fd61f 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h @@ -151,8 +151,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 gfx::Transform GetRootTransform() const override; ui::EventSource* GetEventSource() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; - void Show() override; - void Hide() override; + void ShowImpl() override; + void HideImpl() override; gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& requested_bounds_in_pixels) override; gfx::Point GetLocationOnNativeScreen() const override; |