Commit 32e57d47 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Set shared memory for smoothness inside blink.

Move the allocation of the shared memory segment for ukm smoothness
from RenderWidget to LocalFrameClientImpl.

BUG=1097816

Change-Id: Ib95690ed560e80a4bd43da5be534ae82a5370fce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495612
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821417}
parent db2ace01
...@@ -731,9 +731,8 @@ class CONTENT_EXPORT RenderFrameImpl ...@@ -731,9 +731,8 @@ class CONTENT_EXPORT RenderFrameImpl
void DidCommitAndDrawCompositorFrame() override; void DidCommitAndDrawCompositorFrame() override;
void WasHidden() override; void WasHidden() override;
void WasShown() override; void WasShown() override;
void SetUpSharedMemoryForSmoothness( void SetUpSharedMemoryForSmoothness(
base::ReadOnlySharedMemoryRegion shared_memory); base::ReadOnlySharedMemoryRegion shared_memory) override;
// Binds to the fullscreen service in the browser. // Binds to the fullscreen service in the browser.
void BindFullscreen( void BindFullscreen(
......
...@@ -309,14 +309,6 @@ void RenderWidget::DidNavigate(ukm::SourceId source_id, const GURL& url) { ...@@ -309,14 +309,6 @@ void RenderWidget::DidNavigate(ukm::SourceId source_id, const GURL& url) {
// compositor. Note that the metrics for all frames are keyed to the main // compositor. Note that the metrics for all frames are keyed to the main
// frame's URL. // frame's URL.
layer_tree_host_->SetSourceURL(source_id, url); layer_tree_host_->SetSourceURL(source_id, url);
DCHECK(for_frame());
RenderFrameImpl* render_frame =
RenderFrameImpl::FromWebFrame(GetFrameWidget()->LocalRoot());
auto shmem = layer_tree_host_->CreateSharedMemoryForSmoothnessUkm();
if (shmem.IsValid()) {
render_frame->SetUpSharedMemoryForSmoothness(std::move(shmem));
}
} }
} // namespace content } // namespace content
...@@ -706,6 +706,11 @@ class BLINK_EXPORT WebLocalFrameClient { ...@@ -706,6 +706,11 @@ class BLINK_EXPORT WebLocalFrameClient {
// Inform the widget that it was shown. // Inform the widget that it was shown.
virtual void WasShown() {} virtual void WasShown() {}
// Called after a navigation which set the shared memory region for
// tracking smoothness via UKM.
virtual void SetUpSharedMemoryForSmoothness(
base::ReadOnlySharedMemoryRegion shared_memory) {}
}; };
} // namespace blink } // namespace blink
......
...@@ -538,6 +538,19 @@ void LocalFrameClientImpl::DispatchDidCommitLoad( ...@@ -538,6 +538,19 @@ void LocalFrameClientImpl::DispatchDidCommitLoad(
ResetWheelAndTouchEventHandlerProperties(*web_frame_->GetFrame()); ResetWheelAndTouchEventHandlerProperties(*web_frame_->GetFrame());
web_frame_->FrameWidgetImpl()->DidNavigate(); web_frame_->FrameWidgetImpl()->DidNavigate();
// UKM metrics are only collected for the main frame. Ensure after
// a navigation on the main frame we setup the appropriate structures.
if (web_frame_->GetFrame()->IsMainFrame() &&
web_frame_->ViewImpl()->does_composite()) {
cc::LayerTreeHost* layer_tree_host =
web_frame_->FrameWidgetImpl()->LayerTreeHost();
auto shmem = layer_tree_host->CreateSharedMemoryForSmoothnessUkm();
if (shmem.IsValid()) {
web_frame_->Client()->SetUpSharedMemoryForSmoothness(
std::move(shmem));
}
}
} }
} }
if (WebDevToolsAgentImpl* dev_tools = DevToolsAgent()) if (WebDevToolsAgentImpl* dev_tools = DevToolsAgent())
......
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