Remove DidCommitAndDrawCompositorFrame IPC.
This IPC was used for tests to synchronize with the renderer from the browser process. The RenderFrameSubmissionObserver does this job for us instead now and does not rely on legacy mojo or test-only IPCs. This CL converts the 3 test cases relying on the old IPC over to use the RenderFrameSubmissionObserver utility instead. R=avi@chromium.org, rouslan@chromium.org Bug: 419087 Change-Id: I61d3cf37f55bfbbf97e73f8523605613d4e9be39 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787406 Reviewed-by: Ken Buchanan <kenrb@chromium.org> Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#694304}
This commit is contained in:
chrome/browser
autofill
ui
components/autofill_assistant/browser/web
content
browser
renderer_host
render_view_host_delegate.hrender_view_host_impl.ccrender_view_host_impl.hrender_widget_host_impl.ccrender_widget_host_owner_delegate.h
web_contents
common
public
browser
renderer
test
@ -195,14 +195,18 @@ PageActivityObserver::PageActivityObserver(content::RenderFrameHost* frame)
|
||||
void PageActivityObserver::WaitTillPageIsIdle(
|
||||
base::TimeDelta continuous_paint_timeout) {
|
||||
base::TimeTicks finished_load_time = base::TimeTicks::Now();
|
||||
bool page_is_loading = false;
|
||||
do {
|
||||
paint_occurred_during_last_loop_ = false;
|
||||
base::RunLoop heart_beat;
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
FROM_HERE, heart_beat.QuitClosure(), kPaintEventCheckInterval);
|
||||
heart_beat.Run();
|
||||
page_is_loading =
|
||||
while (true) {
|
||||
content::RenderFrameSubmissionObserver frame_submission_observer(
|
||||
web_contents());
|
||||
// Runs a loop for kPaintEventCheckInterval to see if the renderer is
|
||||
// idle.
|
||||
{
|
||||
base::RunLoop heart_beat;
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
FROM_HERE, heart_beat.QuitClosure(), kPaintEventCheckInterval);
|
||||
heart_beat.Run();
|
||||
}
|
||||
bool page_is_loading =
|
||||
web_contents()->IsWaitingForResponse() || web_contents()->IsLoading();
|
||||
if (page_is_loading) {
|
||||
finished_load_time = base::TimeTicks::Now();
|
||||
@ -214,13 +218,19 @@ void PageActivityObserver::WaitTillPageIsIdle(
|
||||
// blinking caret or a persistent animation is making Chrome paint at
|
||||
// regular intervals. Exit.
|
||||
break;
|
||||
} else if (frame_submission_observer.render_frame_count() == 0) {
|
||||
// If the renderer has stopped submitting frames for the waiting interval
|
||||
// then we're done.
|
||||
break;
|
||||
}
|
||||
} while (page_is_loading || paint_occurred_during_last_loop_);
|
||||
}
|
||||
}
|
||||
|
||||
bool PageActivityObserver::WaitForVisualUpdate(base::TimeDelta timeout) {
|
||||
base::TimeTicks start_time = base::TimeTicks::Now();
|
||||
while (!paint_occurred_during_last_loop_) {
|
||||
content::RenderFrameSubmissionObserver frame_submission_observer(
|
||||
web_contents());
|
||||
while (frame_submission_observer.render_frame_count() == 0) {
|
||||
base::RunLoop heart_beat;
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
FROM_HERE, heart_beat.QuitClosure(), kPaintEventCheckInterval);
|
||||
@ -232,10 +242,6 @@ bool PageActivityObserver::WaitForVisualUpdate(base::TimeDelta timeout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void PageActivityObserver::DidCommitAndDrawCompositorFrame() {
|
||||
paint_occurred_during_last_loop_ = true;
|
||||
}
|
||||
|
||||
// FrameObserver --------------------------------------------------------------
|
||||
IFrameWaiter::IFrameWaiter(content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents),
|
||||
|
@ -117,16 +117,11 @@ class PageActivityObserver : public content::WebContentsObserver {
|
||||
|
||||
private:
|
||||
// PageActivityObserver determines if Chrome stopped painting by checking if
|
||||
// Chrome hasn't painted for a specific amount of time.
|
||||
// kPaintEventCheckInterval defines this amount of time.
|
||||
// the renderer hasn't submitted a compositor frame for a specific amount of
|
||||
// time. kPaintEventCheckInterval defines this amount of time.
|
||||
static constexpr base::TimeDelta kPaintEventCheckInterval =
|
||||
base::TimeDelta::FromMilliseconds(500);
|
||||
|
||||
// content::WebContentsObserver:
|
||||
void DidCommitAndDrawCompositorFrame() override;
|
||||
|
||||
bool paint_occurred_during_last_loop_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PageActivityObserver);
|
||||
};
|
||||
|
||||
|
@ -1164,32 +1164,6 @@ IN_PROC_BROWSER_TEST_F(TopControlsSlideControllerTest, TestPermissionBubble) {
|
||||
TopChromeShownState::kFullyHidden);
|
||||
}
|
||||
|
||||
// Waits for a compositor frame to be drawn and committed on the given
|
||||
// web_contents.
|
||||
class CompositorFrameWaiter : content::WebContentsObserver {
|
||||
public:
|
||||
explicit CompositorFrameWaiter(content::WebContents* contents)
|
||||
: WebContentsObserver(contents) {}
|
||||
~CompositorFrameWaiter() override = default;
|
||||
|
||||
void Wait() {
|
||||
run_loop_ = std::make_unique<base::RunLoop>();
|
||||
run_loop_->Run();
|
||||
run_loop_.reset();
|
||||
}
|
||||
|
||||
// content::WebContentsObserver:
|
||||
void DidCommitAndDrawCompositorFrame() override {
|
||||
if (run_loop_)
|
||||
run_loop_->Quit();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<base::RunLoop> run_loop_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CompositorFrameWaiter);
|
||||
};
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(TopControlsSlideControllerTest, TestToggleChromeVox) {
|
||||
ToggleTabletMode();
|
||||
ASSERT_TRUE(GetTabletModeEnabled());
|
||||
@ -1220,9 +1194,10 @@ IN_PROC_BROWSER_TEST_F(TopControlsSlideControllerTest, TestToggleChromeVox) {
|
||||
|
||||
// Now disable Chromevox, and expect it's now possible to hide top-chrome with
|
||||
// gesture scrolling.
|
||||
CompositorFrameWaiter compositor_frame_waiter(active_contents);
|
||||
content::RenderFrameSubmissionObserver compositor_frame_waiter(
|
||||
active_contents);
|
||||
chromeos::AccessibilityManager::Get()->EnableSpokenFeedback(false);
|
||||
compositor_frame_waiter.Wait();
|
||||
compositor_frame_waiter.WaitForAnyFrameSubmission();
|
||||
content::WaitForResizeComplete(active_contents);
|
||||
EXPECT_FALSE(
|
||||
chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
|
||||
|
@ -46,10 +46,6 @@ class WebControllerBrowserTest : public content::ContentBrowserTest,
|
||||
Observe(shell()->web_contents());
|
||||
}
|
||||
|
||||
void DidCommitAndDrawCompositorFrame() override {
|
||||
paint_occurred_during_last_loop_ = true;
|
||||
}
|
||||
|
||||
void SetUpCommandLine(base::CommandLine* command_line) override {
|
||||
ContentBrowserTest::SetUpCommandLine(command_line);
|
||||
command_line->AppendSwitch("allow-pre-commit-input");
|
||||
@ -57,14 +53,18 @@ class WebControllerBrowserTest : public content::ContentBrowserTest,
|
||||
|
||||
void WaitTillPageIsIdle(base::TimeDelta continuous_paint_timeout) {
|
||||
base::TimeTicks finished_load_time = base::TimeTicks::Now();
|
||||
bool page_is_loading = false;
|
||||
do {
|
||||
paint_occurred_during_last_loop_ = false;
|
||||
base::RunLoop heart_beat;
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
FROM_HERE, heart_beat.QuitClosure(), base::TimeDelta::FromSeconds(3));
|
||||
heart_beat.Run();
|
||||
page_is_loading =
|
||||
while (true) {
|
||||
content::RenderFrameSubmissionObserver frame_submission_observer(
|
||||
web_contents());
|
||||
// Runs a loop for 3 seconds to see if the renderer is idle.
|
||||
{
|
||||
base::RunLoop heart_beat;
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
FROM_HERE, heart_beat.QuitClosure(),
|
||||
base::TimeDelta::FromSeconds(3));
|
||||
heart_beat.Run();
|
||||
}
|
||||
bool page_is_loading =
|
||||
web_contents()->IsWaitingForResponse() || web_contents()->IsLoading();
|
||||
if (page_is_loading) {
|
||||
finished_load_time = base::TimeTicks::Now();
|
||||
@ -76,8 +76,12 @@ class WebControllerBrowserTest : public content::ContentBrowserTest,
|
||||
// blinking caret or a persistent animation is making Chrome paint at
|
||||
// regular intervals. Exit.
|
||||
break;
|
||||
} else if (frame_submission_observer.render_frame_count() == 0) {
|
||||
// If the renderer has stopped submitting frames for 3 seconds then
|
||||
// we're done.
|
||||
break;
|
||||
}
|
||||
} while (page_is_loading || paint_occurred_during_last_loop_);
|
||||
}
|
||||
}
|
||||
|
||||
void RunStrictElementCheck(const Selector& selector, bool result) {
|
||||
@ -461,7 +465,6 @@ class WebControllerBrowserTest : public content::ContentBrowserTest,
|
||||
|
||||
private:
|
||||
std::unique_ptr<net::EmbeddedTestServer> http_server_;
|
||||
bool paint_occurred_during_last_loop_ = false;
|
||||
ClientSettings settings_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebControllerBrowserTest);
|
||||
|
@ -194,10 +194,6 @@ class CONTENT_EXPORT RenderViewHostDelegate {
|
||||
// The RenderView finished the first visually non-empty paint.
|
||||
virtual void DidFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source) {}
|
||||
|
||||
// The RenderView has issued a draw command, signaling the it
|
||||
// has been visually updated.
|
||||
virtual void DidCommitAndDrawCompositorFrame(RenderViewHostImpl* source) {}
|
||||
|
||||
// Returns true if the render view is rendering a portal.
|
||||
virtual bool IsPortal() const;
|
||||
|
||||
|
@ -787,10 +787,6 @@ void RenderViewHostImpl::RenderWidgetDidFirstVisuallyNonEmptyPaint() {
|
||||
delegate_->DidFirstVisuallyNonEmptyPaint(this);
|
||||
}
|
||||
|
||||
void RenderViewHostImpl::RenderWidgetDidCommitAndDrawCompositorFrame() {
|
||||
delegate_->DidCommitAndDrawCompositorFrame(this);
|
||||
}
|
||||
|
||||
bool RenderViewHostImpl::SuddenTerminationAllowed() const {
|
||||
return sudden_termination_allowed_;
|
||||
}
|
||||
|
@ -219,7 +219,6 @@ class CONTENT_EXPORT RenderViewHostImpl
|
||||
void RenderWidgetDidInit() override;
|
||||
void RenderWidgetDidClose() override;
|
||||
void RenderWidgetDidFirstVisuallyNonEmptyPaint() override;
|
||||
void RenderWidgetDidCommitAndDrawCompositorFrame() override;
|
||||
void RenderWidgetGotFocus() override;
|
||||
void RenderWidgetLostFocus() override;
|
||||
void RenderWidgetDidForwardMouseEvent(
|
||||
|
@ -645,8 +645,6 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
|
||||
OnForceRedrawComplete)
|
||||
IPC_MESSAGE_HANDLER(WidgetHostMsg_DidFirstVisuallyNonEmptyPaint,
|
||||
OnFirstVisuallyNonEmptyPaint)
|
||||
IPC_MESSAGE_HANDLER(WidgetHostMsg_DidCommitAndDrawCompositorFrame,
|
||||
OnCommitAndDrawCompositorFrame)
|
||||
IPC_MESSAGE_HANDLER(WidgetHostMsg_HasTouchEventHandlers,
|
||||
OnHasTouchEventHandlers)
|
||||
IPC_MESSAGE_HANDLER(WidgetHostMsg_IntrinsicSizingInfoChanged,
|
||||
@ -1838,11 +1836,6 @@ void RenderWidgetHostImpl::OnFirstVisuallyNonEmptyPaint() {
|
||||
owner_delegate_->RenderWidgetDidFirstVisuallyNonEmptyPaint();
|
||||
}
|
||||
|
||||
void RenderWidgetHostImpl::OnCommitAndDrawCompositorFrame() {
|
||||
if (owner_delegate_)
|
||||
owner_delegate_->RenderWidgetDidCommitAndDrawCompositorFrame();
|
||||
}
|
||||
|
||||
void RenderWidgetHostImpl::RendererExited() {
|
||||
if (!renderer_initialized_)
|
||||
return;
|
||||
|
@ -41,10 +41,6 @@ class CONTENT_EXPORT RenderWidgetHostOwnerDelegate {
|
||||
// The RenderWidget finished the first visually non-empty paint.
|
||||
virtual void RenderWidgetDidFirstVisuallyNonEmptyPaint() = 0;
|
||||
|
||||
// The RenderWidget has issued a draw command, signaling the widget
|
||||
// has been visually updated.
|
||||
virtual void RenderWidgetDidCommitAndDrawCompositorFrame() = 0;
|
||||
|
||||
// The RenderWidgetHost got the focus.
|
||||
virtual void RenderWidgetGotFocus() = 0;
|
||||
|
||||
|
@ -5117,12 +5117,6 @@ void WebContentsImpl::DidFirstVisuallyNonEmptyPaint(
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentsImpl::DidCommitAndDrawCompositorFrame(
|
||||
RenderViewHostImpl* source) {
|
||||
for (auto& observer : observers_)
|
||||
observer.DidCommitAndDrawCompositorFrame();
|
||||
}
|
||||
|
||||
bool WebContentsImpl::IsPortal() const {
|
||||
return portal();
|
||||
}
|
||||
|
@ -698,7 +698,6 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
|
||||
bool IsSpatialNavigationDisabled() const override;
|
||||
RenderFrameHost* GetPendingMainFrame() override;
|
||||
void DidFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source) override;
|
||||
void DidCommitAndDrawCompositorFrame(RenderViewHostImpl* source) override;
|
||||
bool IsPortal() const override;
|
||||
|
||||
// NavigatorDelegate ---------------------------------------------------------
|
||||
|
@ -333,9 +333,6 @@ IPC_MESSAGE_ROUTED0(WidgetHostMsg_WaitForNextFrameForTests_ACK)
|
||||
// after the frame widget has painted something.
|
||||
IPC_MESSAGE_ROUTED0(WidgetHostMsg_DidFirstVisuallyNonEmptyPaint)
|
||||
|
||||
// Sent once the RenderWidgetCompositor issues a draw command.
|
||||
IPC_MESSAGE_ROUTED0(WidgetHostMsg_DidCommitAndDrawCompositorFrame)
|
||||
|
||||
// Notifies whether there are JavaScript touch event handlers or not.
|
||||
IPC_MESSAGE_ROUTED1(WidgetHostMsg_HasTouchEventHandlers,
|
||||
bool /* has_handlers */)
|
||||
|
@ -568,11 +568,6 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener {
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedMessagePipeHandle* interface_pipe) {}
|
||||
|
||||
// Notifies that the RenderWidgetCompositor has issued a draw command. An
|
||||
// observer can use this method to detect when Chrome visually updated a
|
||||
// tab.
|
||||
virtual void DidCommitAndDrawCompositorFrame() {}
|
||||
|
||||
// Called when "audible" playback starts or stops on a WebAudio AudioContext.
|
||||
using AudioContextId = std::pair<RenderFrameHost*, int>;
|
||||
virtual void AudioContextPlaybackStarted(
|
||||
|
@ -1217,8 +1217,6 @@ void RenderWidget::DidCommitAndDrawCompositorFrame() {
|
||||
|
||||
// Notify subclasses that we initiated the paint operation.
|
||||
DidInitiatePaint();
|
||||
|
||||
Send(new WidgetHostMsg_DidCommitAndDrawCompositorFrame(routing_id_));
|
||||
}
|
||||
|
||||
void RenderWidget::WillCommitCompositorFrame() {
|
||||
|
@ -14,7 +14,6 @@ class StubRenderWidgetHostOwnerDelegate : public RenderWidgetHostOwnerDelegate {
|
||||
void RenderWidgetDidInit() override {}
|
||||
void RenderWidgetDidClose() override {}
|
||||
void RenderWidgetDidFirstVisuallyNonEmptyPaint() override {}
|
||||
void RenderWidgetDidCommitAndDrawCompositorFrame() override {}
|
||||
void RenderWidgetGotFocus() override {}
|
||||
void RenderWidgetLostFocus() override {}
|
||||
void RenderWidgetDidForwardMouseEvent(
|
||||
|
Reference in New Issue
Block a user