Commit da7d41dc authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev Committed by Commit Bot

Add profile CHECKs in ChromeAshMessageCenterClient

This should help investigating a recurring crash (see linked bug).

Bug: 957121
Test: none
Change-Id: I78f30855201ebd9fb4d8d1738131f5c2308f1e44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586227
Commit-Queue: Vladislav Kaznacheev <kaznacheev@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Auto-Submit: Vladislav Kaznacheev <kaznacheev@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659258}
parent 3c9a4cd0
...@@ -151,16 +151,18 @@ void ChromeAshMessageCenterClient::DisableNotification(const std::string& id) { ...@@ -151,16 +151,18 @@ void ChromeAshMessageCenterClient::DisableNotification(const std::string& id) {
void ChromeAshMessageCenterClient::SetNotifierEnabled( void ChromeAshMessageCenterClient::SetNotifierEnabled(
const NotifierId& notifier_id, const NotifierId& notifier_id,
bool enabled) { bool enabled) {
sources_[notifier_id.type]->SetNotifierEnabled(GetProfileForNotifiers(), Profile* profile = GetProfileForNotifiers();
notifier_id, enabled); CHECK(profile);
sources_[notifier_id.type]->SetNotifierEnabled(profile, notifier_id, enabled);
} }
void ChromeAshMessageCenterClient::GetNotifierList( void ChromeAshMessageCenterClient::GetNotifierList(
GetNotifierListCallback callback) { GetNotifierListCallback callback) {
Profile* profile = GetProfileForNotifiers();
CHECK(profile);
std::vector<ash::mojom::NotifierUiDataPtr> notifiers; std::vector<ash::mojom::NotifierUiDataPtr> notifiers;
for (auto& source : sources_) { for (auto& source : sources_) {
auto source_notifiers = auto source_notifiers = source.second->GetNotifierList(profile);
source.second->GetNotifierList(GetProfileForNotifiers());
for (auto& notifier : source_notifiers) { for (auto& notifier : source_notifiers) {
notifiers.push_back(std::move(notifier)); notifiers.push_back(std::move(notifier));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment