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

Unified Diff: ash/wm/lock_state_controller.cc

Issue 435083002: ash: Fix a screen-locking crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: start timer as long as screen isn't already locked Created 6 years, 5 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
Index: ash/wm/lock_state_controller.cc
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc
index 09a46afa2a1436404485a642a920205f69a4cad8..754d4b68eacd050d43832215092f849f1288359c 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,9 +585,12 @@ void LockStateController::LockAnimationCancelled() {
}
void LockStateController::PreLockAnimationFinished(bool request_lock) {
- can_cancel_lock_animation_ = false;
VLOG(1) << "PreLockAnimationFinished";
+ can_cancel_lock_animation_ = false;
+
if (request_lock) {
+ DCHECK(!system_is_locked_) << "Got request to lock already-locked system "
+ << "at completion of pre-lock animation";
Shell::GetInstance()->metrics()->RecordUserMetricsAction(
shutdown_after_lock_ ?
UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON :
@@ -594,24 +598,23 @@ void LockStateController::PreLockAnimationFinished(bool request_lock) {
delegate_->RequestLockScreen();
oshima 2014/08/01 23:29:58 Just for my understanding. Where do we request loc
Daniel Erat 2014/08/01 23:52:06 this is a maze of similarly-named methods, but i t
}
- int lock_timeout = kLockFailTimeoutMs;
-
+ // Don't start the lock-fail timer if the screen was already locked while the
+ // animation was going.
+ if (!system_is_locked_) {
oshima 2014/08/01 23:29:58 nit: early exit?
Daniel Erat 2014/08/01 23:52:06 Done.
+ 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
- if (board == "x86-mario" ||
- board.substr(0, 8) == "x86-alex" ||
- board.substr(0, 7) == "x86-zgb") {
- lock_timeout *= 2;
- }
+ // Increase lock timeout for slower hardware, see http://crbug.com/350628
+ const std::string board = base::SysInfo::GetLsbReleaseBoard();
+ if (board == "x86-mario" ||
+ StartsWithASCII(board, "x86-alex", true) ||
+ StartsWithASCII(board, "x86-zgb", true)) {
oshima 2014/08/01 23:29:58 don't have to be in this CL, but there are a lot o
Daniel Erat 2014/08/01 23:52:06 i think that powerd only gives chrome ten seconds
oshima 2014/08/02 00:27:53 This can happen with shift-ctrl-l without suspendi
Daniel Erat 2014/08/02 00:38:13 yes, there are a bunch of ways the screen can be l
+ timeout *= 2;
+ }
#endif
-
- lock_fail_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(lock_timeout),
- this,
- &LockStateController::OnLockFailTimeout);
+ lock_fail_timer_.Start(
+ FROM_HERE, timeout, this, &LockStateController::OnLockFailTimeout);
+ }
}
void LockStateController::PostLockAnimationFinished() {

Powered by Google App Engine
This is Rietveld 408576698