Commit 15385529 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move notification of RenderFrame DidCommitAndDrawCompositorFrame.

Move the notification of DidCommitAndDrawCompositorFrame inside blink.
This avoids having to iterate on the render_frames_ inside RenderWidget.

BUG=1097816

Change-Id: Ia785f8482b5d420668edcbb10e2aba944b456aef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410338
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807149}
parent 78e21865
......@@ -51,7 +51,7 @@ constexpr char kEventCapture[] = "Capture";
constexpr char kEventSuffixFailRate[] = "FailRate";
constexpr char kEventSuffixLatency[] = "Latency";
constexpr char kEventCommitAndDrawCompositorFrame[] =
"RenderWidget::DidCommitAndDrawCompositorFrame";
"WidgetBase::DidCommitAndDrawCompositorFrame";
const std::unordered_map<std::string, std::string> kEventToMetricMap(
{{kEventCapture, kMetricCaptureMs},
{std::string(kEventCapture) + kEventSuffixFailRate,
......
......@@ -283,9 +283,6 @@ class CONTENT_EXPORT RenderFrameImpl
~RenderFrameImpl() override;
// Draw commands have been issued by blink::LayerTreeView.
void DidCommitAndDrawCompositorFrame();
// Returns the unique name of the RenderFrame.
const std::string& unique_name() const { return unique_name_helper_.value(); }
......@@ -773,6 +770,7 @@ class CONTENT_EXPORT RenderFrameImpl
const base::UnguessableToken& input_stream_id,
const std::string& output_device_id) override;
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
void DidCommitAndDrawCompositorFrame() override;
// Binds to the fullscreen service in the browser.
void BindFullscreen(
......
......@@ -568,15 +568,6 @@ void RenderWidget::RequestNewLayerTreeFrameSink(
this, std::move(url), std::move(callback), client_name);
}
void RenderWidget::DidCommitAndDrawCompositorFrame() {
// NOTE: Tests may break if this event is renamed or moved. See
// tab_capture_performancetest.cc.
TRACE_EVENT0("gpu", "RenderWidget::DidCommitAndDrawCompositorFrame");
for (auto& observer : render_frames_)
observer.DidCommitAndDrawCompositorFrame();
}
void RenderWidget::DidCommitCompositorFrame(base::TimeTicks commit_start_time) {
if (delegate())
delegate()->DidCommitCompositorFrameForWidget();
......
......@@ -261,7 +261,6 @@ class CONTENT_EXPORT RenderWidget
base::OnceCallback<void(bool)> callback) override;
viz::FrameSinkId GetFrameSinkId() override;
void RecordTimeToFirstActivePaint(base::TimeDelta duration) override;
void DidCommitAndDrawCompositorFrame() override;
void DidCommitCompositorFrame(base::TimeTicks commit_start_time) override;
void DidCompletePageScaleAnimation() override;
void RequestNewLayerTreeFrameSink(
......
......@@ -103,7 +103,6 @@ TEST_F(RenderWidgetTest, OnSynchronizeVisualProperties) {
// Clear the flag.
widget()->DidCommitCompositorFrame(base::TimeTicks());
widget()->DidCommitAndDrawCompositorFrame();
// Setting the same size again should not send the ack.
OnSynchronizeVisualProperties(visual_properties);
......
......@@ -697,6 +697,10 @@ class BLINK_EXPORT WebLocalFrameClient {
// layout that happened after an interesting document lifecycle change (see
// WebMeaningfulLayout for details.)
virtual void DidMeaningfulLayout(WebMeaningfulLayout) {}
// Notification that the BeginMainFrame completed, was committed into the
// compositor (thread) and submitted to the display compositor.
virtual void DidCommitAndDrawCompositorFrame() {}
};
} // namespace blink
......
......@@ -204,10 +204,6 @@ class WebWidgetClient {
// perform actual painting work.
virtual void WillBeginMainFrame() {}
// Notification that the BeginMainFrame completed, was committed into the
// compositor (thread) and submitted to the display compositor.
virtual void DidCommitAndDrawCompositorFrame() {}
// Notification that page scale animation was changed.
virtual void DidCompletePageScaleAnimation() {}
......
......@@ -81,15 +81,15 @@ namespace blink {
namespace {
void ForEachWebLocalFrameControlledByWidget(
WebLocalFrame* frame,
void ForEachLocalFrameControlledByWidget(
LocalFrame* frame,
const base::RepeatingCallback<void(WebLocalFrame*)>& callback) {
callback.Run(frame);
for (WebFrame* child = frame->FirstChild(); child;
callback.Run(WebLocalFrameImpl::FromFrame(frame));
for (Frame* child = frame->FirstChild(); child;
child = child->NextSibling()) {
if (child->IsWebLocalFrame()) {
ForEachWebLocalFrameControlledByWidget(child->ToWebLocalFrame(),
callback);
if (child->IsLocalFrame()) {
ForEachLocalFrameControlledByWidget(DynamicTo<LocalFrame>(child),
callback);
}
}
}
......@@ -554,7 +554,11 @@ void WebFrameWidgetBase::EndCommitCompositorFrame(
}
void WebFrameWidgetBase::DidCommitAndDrawCompositorFrame() {
Client()->DidCommitAndDrawCompositorFrame();
ForEachLocalFrameControlledByWidget(
local_root_->GetFrame(),
WTF::BindRepeating([](WebLocalFrame* local_frame) {
local_frame->Client()->DidCommitAndDrawCompositorFrame();
}));
}
void WebFrameWidgetBase::DidObserveFirstScrollDelay(
......@@ -666,8 +670,9 @@ void WebFrameWidgetBase::UpdateVisualProperties(
visual_properties);
if (old_visible_viewport_size != widget_base_->VisibleViewportSize()) {
ForEachWebLocalFrameControlledByWidget(
local_root_, WTF::BindRepeating([](WebLocalFrame* local_frame) {
ForEachLocalFrameControlledByWidget(
local_root_->GetFrame(),
WTF::BindRepeating([](WebLocalFrame* local_frame) {
local_frame->Client()->ResetHasScrolledFocusedEditableIntoView();
}));
......@@ -1176,8 +1181,8 @@ void WebFrameWidgetBase::DidMeaningfulLayout(WebMeaningfulLayout layout_type) {
WrapPersistent(this)));
}
ForEachWebLocalFrameControlledByWidget(
local_root_,
ForEachLocalFrameControlledByWidget(
local_root_->GetFrame(),
WTF::BindRepeating(
[](WebMeaningfulLayout layout_type, WebLocalFrame* local_frame) {
local_frame->Client()->DidMeaningfulLayout(layout_type);
......
......@@ -397,6 +397,10 @@ void WidgetBase::RequestNewLayerTreeFrameSink(
}
void WidgetBase::DidCommitAndDrawCompositorFrame() {
// NOTE: Tests may break if this event is renamed or moved. See
// tab_capture_performancetest.cc.
TRACE_EVENT0("gpu", "WidgetBase::DidCommitAndDrawCompositorFrame");
client_->DidCommitAndDrawCompositorFrame();
}
......
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