diff options
author | vangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 06:07:50 +0000 |
---|---|---|
committer | vangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 06:07:50 +0000 |
commit | babf78eeea2bc37155eac995c6f93efb955e69a2 (patch) | |
tree | f937fe06d29c2e49a74d3766e16e20dcb47e3b2b /ui/surface | |
parent | c404bd8b7f13cb246d6537cd6ab9d2caa5ff4012 (diff) | |
download | chromium_src-babf78eeea2bc37155eac995c6f93efb955e69a2.zip chromium_src-babf78eeea2bc37155eac995c6f93efb955e69a2.tar.gz chromium_src-babf78eeea2bc37155eac995c6f93efb955e69a2.tar.bz2 |
Switch do GDI rendering when the screensaver is active.
When the screen saver or login-screen are active, any calls we make to d3d present get
ignored. As a result, after coming back, the browser displays stale contents until the
page refreshes again. This is only a problem if AERO (the Windows compositor) is turned
on.
With AERO on, our window doesn't seem to be getting any useful notifications when we enter or exit the
screensaver that we could use to trigger a repaint. With AERO off we get a WM_PAINT which forces
us to repaint.
If we use the GDI display path (which requires an expensive texture readback and a blit)
the contents of the window update correctly. The unfortunate side-effect of this change is that
while in screen saver mode our CPU utilization for pages that update often (e.g. have an
active CSS animation) will significantly increase.
BUG=133121
Review URL: https://chromiumcodereview.appspot.com/11863013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/surface')
-rw-r--r-- | ui/surface/accelerated_surface_win.cc | 25 | ||||
-rw-r--r-- | ui/surface/accelerated_surface_win.h | 9 |
2 files changed, 33 insertions, 1 deletions
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc index 8e6e809..abd0745 100644 --- a/ui/surface/accelerated_surface_win.cc +++ b/ui/surface/accelerated_surface_win.cc @@ -24,6 +24,7 @@ #include "base/time.h" #include "base/win/wrapped_window_proc.h" #include "ui/base/win/hwnd_util.h" +#include "ui/base/win/shell.h" #include "ui/gfx/rect.h" #include "ui/gl/gl_switches.h" #include "ui/surface/accelerated_surface_transformer_win.h" @@ -253,7 +254,8 @@ AcceleratedPresenter::AcceleratedPresenter(gfx::PluginWindowHandle window) event_(false, false), hidden_(true), do_present_with_GDI_(DoAllShowPresentWithGDI() || - DoFirstShowPresentWithGDI()) { + DoFirstShowPresentWithGDI()), + is_session_locked_(false) { } // static @@ -434,6 +436,10 @@ void AcceleratedPresenter::ReleaseSurface() { this)); } +void AcceleratedPresenter::SetIsSessionLocked(bool locked) { + is_session_locked_ = locked; +} + void AcceleratedPresenter::Invalidate() { // Make any pending or future presentation tasks do nothing. Once the last // last pending task has been ignored, the reference count on the presenter @@ -752,6 +758,19 @@ gfx::Size AcceleratedPresenter::GetWindowSize() { } bool AcceleratedPresenter::CheckDirect3DWillWork() { + // On a composited desktop, when the screen saver or logon screen are + // active, D3D presents never make it to the window but GDI presents + // do. If the session is locked GDI presents can be avoided since + // the window gets a message on unlock and forces a repaint. + if (!is_session_locked_ && ui::win::IsAeroGlassEnabled()) { + // Failure to open the input desktop is a sign of running with a non-default + // desktop. + HDESK input_desktop = ::OpenInputDesktop(0, 0, GENERIC_READ); + if (!input_desktop) + return false; + ::CloseDesktop(input_desktop); + } + gfx::Size window_size = GetWindowSize(); if (window_size != last_window_size_ && last_window_size_.GetArea() != 0) { last_window_size_ = window_size; @@ -799,3 +818,7 @@ void AcceleratedSurface::Suspend() { void AcceleratedSurface::WasHidden() { presenter_->WasHidden(); } + +void AcceleratedSurface::SetIsSessionLocked(bool locked) { + presenter_->SetIsSessionLocked(locked); +} diff --git a/ui/surface/accelerated_surface_win.h b/ui/surface/accelerated_surface_win.h index 67a4542..4dacb87 100644 --- a/ui/surface/accelerated_surface_win.h +++ b/ui/surface/accelerated_surface_win.h @@ -54,6 +54,9 @@ class SURFACE_EXPORT AcceleratedPresenter // Indicates that the presenter has become invisible. void WasHidden(); + // Called when the Windows session is locked or unlocked. + void SetIsSessionLocked(bool locked); + // Schedule the presenter to release its reference to the shared surface. void ReleaseSurface(); @@ -143,6 +146,9 @@ class SURFACE_EXPORT AcceleratedPresenter // with GDI. bool do_present_with_GDI_; + // Set to true when the Windows session is locked. + bool is_session_locked_; + // These are used to detect when the window is resizing. For some reason, // presenting with D3D while the window resizes causes those parts not // drawn with D3D (e.g. with GDI) to flicker visible / invisible. @@ -179,6 +185,9 @@ class SURFACE_EXPORT AcceleratedSurface { // Indicates that the surface has become invisible. void WasHidden(); + // Called when the Windows session in locked or unlocked. + void SetIsSessionLocked(bool locked); + private: const scoped_refptr<AcceleratedPresenter> presenter_; DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |