Commit 11590fa2 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Add more fail safes to Extension Event Router.

To investigate a crash on ChromeOS, fail safe code and reporting are
added to EventRouter dispatcher.

Bug: 870838
Change-Id: I536a581c142d3b760f5a564507d4251b2b881c0e
Reviewed-on: https://chromium-review.googlesource.com/c/1356587Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612668}
parent 25f4614e
......@@ -730,12 +730,24 @@ void EventRouter::DoDispatchEventToSenderBookkeepingOnUI(
}
if (!ExtensionsBrowserClient::Get()->IsValidContext(browser_context))
return;
// TODO(https://crbug.com/870838): Remove after investigating the bug.
if (!ExtensionRegistry::Get(browser_context)) {
LOG(ERROR) << "ExtensionRegistry does not exist.";
NOTREACHED();
return;
}
const Extension* extension =
ExtensionRegistry::Get(browser_context)->enabled_extensions().GetByID(
extension_id);
if (!extension)
return;
EventRouter* event_router = EventRouter::Get(browser_context);
// TODO(https://crbug.com/870838): Remove after investigating the bug.
if (!event_router) {
LOG(ERROR) << "EventRouter does not exist.";
NOTREACHED();
return;
}
event_router->IncrementInFlightEvents(browser_context, extension, event_id,
event_name);
event_router->ReportEvent(histogram_value, extension,
......
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