Chromium Code Reviews| Index: content/public/browser/screen_orientation_provider.cc |
| diff --git a/content/public/browser/screen_orientation_provider.cc b/content/public/browser/screen_orientation_provider.cc |
| index 1a5350ded026755d2ef97e76a021e641ae114e71..0a930d814813ef87072e4ee7e322cf92241df9f7 100644 |
| --- a/content/public/browser/screen_orientation_provider.cc |
| +++ b/content/public/browser/screen_orientation_provider.cc |
| @@ -28,9 +28,9 @@ ScreenOrientationProvider::~ScreenOrientationProvider() { |
| void ScreenOrientationProvider::LockOrientation( |
| blink::WebScreenOrientationLockType orientation, |
| const LockOrientationCallback& callback) { |
| - // ScreenOrientation should have cancelled all pending request at this point. |
| - DCHECK(on_result_callback_.is_null()); |
|
leonhsl(Using Gerrit)
2017/01/16 11:00:18
Although ScreenOrientation have cancelled the pend
|
| - DCHECK(!pending_lock_orientation_.has_value()); |
| + // ScreenOrientation should have already cancelled all pending request at this |
| + // point, so we just clear pending status here without any actual operations. |
| + pending_lock_orientation_.reset(); |
| on_result_callback_ = callback; |
| if (!delegate_ || !delegate_->ScreenOrientationProviderSupported()) { |
| @@ -103,11 +103,9 @@ void ScreenOrientationProvider::OnOrientationChange() { |
| void ScreenOrientationProvider::NotifyLockResult( |
| ScreenOrientationLockResult result) { |
| - if (on_result_callback_.is_null()) { |
| - pending_lock_orientation_.reset(); |
| - return; |
| + if (!on_result_callback_.is_null()) { |
| + base::ResetAndReturn(&on_result_callback_).Run(result); |
| } |
| - base::ResetAndReturn(&on_result_callback_).Run(result); |
| pending_lock_orientation_.reset(); |
| } |