Skip to content

Commit

Permalink
Add a CHECK to debug a crash while showing app list
Browse files Browse the repository at this point in the history
Adds a CHECK to help debugging https://crbug.com/1307871.
The crash occurs when looking up split view controller for the target
display while showing the app list. One possible cause may be the app
list getting hidden while the app list view is still being shown
(in which case we'd end up looking up split view controller for null
root window). This adds a CHECK that crashes earlier if this situation
occurs.

BUG=1307871

Change-Id: I35a7f3623d916f785cad0474de133a8cd19a99fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758327
Reviewed-by: Andrew Xu <andrewxu@chromium.org>
Commit-Queue: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1023456}
  • Loading branch information
Toni Barzic authored and Chromium LUCI CQ committed Jul 12, 2022
1 parent fe29d5d commit 6ef26f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ash/app_list/app_list_presenter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ void AppListPresenterImpl::Show(AppListViewState preferred_state,
return;
}

// TODO(https://crbug.com/1307871): Remove this when the linked crash gets
// diagnosed - the crash is possible if app list gets dismissed while being
// shown. `showing_app_list_` in intended to catch this case.
showing_app_list_ = true;

is_target_visibility_show_ = true;
OnVisibilityWillChange(GetTargetVisibility(), display_id);
RequestPresentationTime(display_id, event_time_stamp);
Expand Down Expand Up @@ -231,6 +236,7 @@ void AppListPresenterImpl::Show(AppListViewState preferred_state,
event_filter_ =
std::make_unique<AppListPresenterEventFilter>(controller_, this, view_);
controller_->ViewShown(display_id);
showing_app_list_ = false;

OnVisibilityChanged(GetTargetVisibility(), display_id);
}
Expand All @@ -243,6 +249,10 @@ void AppListPresenterImpl::Dismiss(base::TimeTicks event_time_stamp) {
// view.
DCHECK(view_);

// TODO(https://crbug.com/1307871): Remove this when the linked crash gets
// diagnosed.
CHECK(!showing_app_list_);

is_target_visibility_show_ = false;
RequestPresentationTime(GetDisplayId(), event_time_stamp);

Expand Down
5 changes: 5 additions & 0 deletions ash/app_list/app_list_presenter_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ class ASH_EXPORT AppListPresenterImpl
absl::optional<base::Time> last_open_time_;
absl::optional<AppListShowSource> last_open_source_;

// Whether the presenter is currently changing app list view state to shown.
// TODO(https://crbug.com/1307871): Remove this when the linked crash gets
// diagnosed.
bool showing_app_list_ = false;

base::WeakPtrFactory<AppListPresenterImpl> weak_ptr_factory_{this};
};

Expand Down

0 comments on commit 6ef26f8

Please sign in to comment.