Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to avoid crash from SidePanelCoordinator::PopulateSidePanel() (uplift to 1.68.x) #24541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions browser/ui/views/side_panel/brave_side_panel_coordinator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include "brave/browser/ui/views/side_panel/brave_side_panel_coordinator.h"

#include <optional>
#include <string>
#include <utility>

#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "brave/browser/ui/sidebar/sidebar_service_factory.h"
#include "brave/browser/ui/sidebar/sidebar_utils.h"
Expand Down Expand Up @@ -146,3 +149,21 @@ void BraveSidePanelCoordinator::UpdateToolbarButtonHighlight(
: IDS_TOOLTIP_SIDEBAR_SHOW));
}
}

void BraveSidePanelCoordinator::PopulateSidePanel(
bool supress_animations,
SidePanelEntry* entry,
std::optional<std::unique_ptr<views::View>> content_view) {
CHECK(entry);
actions::ActionItem* const action_item = GetActionItem(entry->key());
if (!action_item) {
const std::string entry_id = SidePanelEntryIdToString(entry->key().id());
LOG(ERROR) << __func__ << " no side panel action item for " << entry_id;
SCOPED_CRASH_KEY_STRING64("SidePanel", "entry_id", entry_id);
base::debug::DumpWithoutCrashing();
return;
}

SidePanelCoordinator::PopulateSidePanel(supress_animations, entry,
std::move(content_view));
}
4 changes: 4 additions & 0 deletions browser/ui/views/side_panel/brave_side_panel_coordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class BraveSidePanelCoordinator : public SidePanelCoordinator {
SidePanelUtil::SidePanelOpenTrigger open_trigger) override;
void OnViewVisibilityChanged(views::View* observed_view,
views::View* starting_from) override;
void PopulateSidePanel(
bool supress_animations,
SidePanelEntry* entry,
std::optional<std::unique_ptr<views::View>> content_view) override;

private:
// Returns the last active entry or the default entry if no last active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
virtual std::unique_ptr<views::View> CreateHeader

#define UpdateToolbarButtonHighlight virtual UpdateToolbarButtonHighlight
#define PopulateSidePanel virtual PopulateSidePanel

#include "src/chrome/browser/ui/views/side_panel/side_panel_coordinator.h" // IWYU pragma: export

#undef PopulateSidePanel
#undef UpdateToolbarButtonHighlight
#undef CreateHeader

Expand Down
Loading