Commit 4adfc23b authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

[cc/metrics] Gracefully handle shared-memory allocation failure.

If shared-memory allocation for smoothness-ukm data fails, then
handle that error gracefully, rather than crashing out.

BUG=1134659

Change-Id: I309e478ce112d9e0303d7aea6619260abac0cfe1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446929Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Auto-Submit: Sadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813405}
parent d3075dda
......@@ -1865,7 +1865,8 @@ base::ReadOnlySharedMemoryRegion
LayerTreeHost::CreateSharedMemoryForSmoothnessUkm() {
const auto size = sizeof(UkmSmoothnessDataShared);
ukm_smoothness_mapping_ = base::ReadOnlySharedMemoryRegion::Create(size);
DCHECK(ukm_smoothness_mapping_.IsValid());
if (!ukm_smoothness_mapping_.IsValid())
return {};
proxy_->SetUkmSmoothnessDestination(
ukm_smoothness_mapping_.mapping.GetMemoryAs<UkmSmoothnessDataShared>());
return std::move(ukm_smoothness_mapping_.region);
......
......@@ -739,8 +739,10 @@ void RenderWidget::DidNavigate(ukm::SourceId source_id, const GURL& url) {
DCHECK(for_frame());
RenderFrameImpl* render_frame =
RenderFrameImpl::FromWebFrame(GetFrameWidget()->LocalRoot());
render_frame->SetUpSharedMemoryForSmoothness(
layer_tree_host_->CreateSharedMemoryForSmoothnessUkm());
auto shmem = layer_tree_host_->CreateSharedMemoryForSmoothnessUkm();
if (shmem.IsValid()) {
render_frame->SetUpSharedMemoryForSmoothness(std::move(shmem));
}
}
blink::WebInputMethodController* RenderWidget::GetInputMethodController()
......
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