diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 02:58:44 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 02:58:44 +0000 |
commit | d127d79cdc8f01a9bad9148806f02b11a6174f29 (patch) | |
tree | f6873634dcea81962a3e6f8954e20b0d5f4d2f34 | |
parent | bd8c1a953edc059700585a13a82680c8e8b566e3 (diff) | |
download | chromium_src-d127d79cdc8f01a9bad9148806f02b11a6174f29.zip chromium_src-d127d79cdc8f01a9bad9148806f02b11a6174f29.tar.gz chromium_src-d127d79cdc8f01a9bad9148806f02b11a6174f29.tar.bz2 |
Merge 287187 "ash: Fix a screen-locking crash."
> ash: Fix a screen-locking crash.
>
> LockStateController starts its 350 ms pre-lock animation
> when the screen is locked via the system tray. When the
> animation completes, the controller was incorrectly starting
> the lock-fail timer. If the lock screen had already become
> ready before this point (possible on a fast system), the
> timer would crash the process eight seconds later.
>
> Change LockStateController to only start the timer when
> actually requesting that the screen be locked.
>
> BUG=349083
>
> Review URL: https://codereview.chromium.org/435083002
TBR=derat@chromium.org
Review URL: https://codereview.chromium.org/449313002
git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@288208 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/wm/lock_state_controller.cc | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 09a46af..ebb0698 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -16,6 +16,7 @@ #include "ash/wm/session_state_animator.h" #include "base/bind_helpers.h" #include "base/command_line.h" +#include "base/strings/string_util.h" #include "base/timer/timer.h" #include "ui/aura/window_tree_host.h" #include "ui/compositor/layer_animation_sequence.h" @@ -584,8 +585,17 @@ void LockStateController::LockAnimationCancelled() { } void LockStateController::PreLockAnimationFinished(bool request_lock) { - can_cancel_lock_animation_ = false; VLOG(1) << "PreLockAnimationFinished"; + can_cancel_lock_animation_ = false; + + // Don't do anything (including starting the lock-fail timer) if the screen + // was already locked while the animation was going. + if (system_is_locked_) { + DCHECK(!request_lock) << "Got request to lock already-locked system " + << "at completion of pre-lock animation"; + return; + } + if (request_lock) { Shell::GetInstance()->metrics()->RecordUserMetricsAction( shutdown_after_lock_ ? @@ -594,24 +604,19 @@ void LockStateController::PreLockAnimationFinished(bool request_lock) { delegate_->RequestLockScreen(); } - int lock_timeout = kLockFailTimeoutMs; - + base::TimeDelta timeout = + base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs); #if defined(OS_CHROMEOS) - std::string board = base::SysInfo::GetLsbReleaseBoard(); - // Increase lock timeout for slower hardware, see http://crbug.com/350628 + const std::string board = base::SysInfo::GetLsbReleaseBoard(); if (board == "x86-mario" || - board.substr(0, 8) == "x86-alex" || - board.substr(0, 7) == "x86-zgb") { - lock_timeout *= 2; + StartsWithASCII(board, "x86-alex", true /* case_sensitive */) || + StartsWithASCII(board, "x86-zgb", true /* case_sensitive */)) { + timeout *= 2; } #endif - lock_fail_timer_.Start( - FROM_HERE, - base::TimeDelta::FromMilliseconds(lock_timeout), - this, - &LockStateController::OnLockFailTimeout); + FROM_HERE, timeout, this, &LockStateController::OnLockFailTimeout); } void LockStateController::PostLockAnimationFinished() { |