Commit 1574cf43 authored by danakj's avatar danakj Committed by Commit Bot

Remove needs_repainting from the WasShown IPC to the RenderWidget.

This bool is always true, and is not used. No need to send it.
Also removes the dead needs_repainting_on_restore_ from the
RenderWidgetHostImpl.

R=ajwong@chromium.org, dcheng@chromium.org, piman@chromium.org

Bug: 419087
Change-Id: I673e5de215a9118b061478260d0dc012ae078d37
Reviewed-on: https://chromium-review.googlesource.com/1246942Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594482}
parent ff85daec
...@@ -346,7 +346,6 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, ...@@ -346,7 +346,6 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
visual_properties_ack_pending_(false), visual_properties_ack_pending_(false),
auto_resize_enabled_(false), auto_resize_enabled_(false),
waiting_for_screen_rects_ack_(false), waiting_for_screen_rects_ack_(false),
needs_repainting_on_restore_(false),
is_unresponsive_(false), is_unresponsive_(false),
in_flight_event_count_(0), in_flight_event_count_(0),
in_get_backing_store_(false), in_get_backing_store_(false),
...@@ -727,12 +726,9 @@ void RenderWidgetHostImpl::WasShown(bool record_presentation_time) { ...@@ -727,12 +726,9 @@ void RenderWidgetHostImpl::WasShown(bool record_presentation_time) {
SendScreenRects(); SendScreenRects();
RestartInputEventAckTimeoutIfNecessary(); RestartInputEventAckTimeoutIfNecessary();
// Always repaint on restore. Send(new ViewMsg_WasShown(routing_id_, record_presentation_time
bool needs_repainting = true; ? base::TimeTicks::Now()
needs_repainting_on_restore_ = false; : base::TimeTicks()));
Send(new ViewMsg_WasShown(
routing_id_, needs_repainting,
record_presentation_time ? base::TimeTicks::Now() : base::TimeTicks()));
process_->UpdateClientPriority(this); process_->UpdateClientPriority(this);
......
...@@ -757,7 +757,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl ...@@ -757,7 +757,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
private: private:
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest,
DontPostponeInputEventAckTimeout); DontPostponeInputEventAckTimeout);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HideShowMessages);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, RendererExitedNoDrag); FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, RendererExitedNoDrag);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest,
StopAndStartInputEventAckTimeout); StopAndStartInputEventAckTimeout);
...@@ -987,12 +987,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl ...@@ -987,12 +987,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// The observers watching us. // The observers watching us.
base::ObserverList<RenderWidgetHostObserver>::Unchecked observers_; base::ObserverList<RenderWidgetHostObserver>::Unchecked observers_;
// If true, then we should repaint when restoring even if we have a
// backingstore. This flag is set to true if we receive a paint message
// while is_hidden_ to true. Even though we tell the render widget to hide
// itself, a paint message could already be in flight at that point.
bool needs_repainting_on_restore_;
// This is true if the renderer is currently unresponsive. // This is true if the renderer is currently unresponsive.
bool is_unresponsive_; bool is_unresponsive_;
......
...@@ -1203,9 +1203,9 @@ TEST_F(RenderWidgetHostTest, Background) { ...@@ -1203,9 +1203,9 @@ TEST_F(RenderWidgetHostTest, Background) {
} }
#endif #endif
// Test that we don't paint when we're hidden, but we still send the ACK. Most // Test that the RenderWidgetHost tells the renderer when it is hidden and
// of the rest of the painting is tested in the GetBackingStore* ones. // shown, and can accept a racey update from the renderer after hiding.
TEST_F(RenderWidgetHostTest, HiddenPaint) { TEST_F(RenderWidgetHostTest, HideShowMessages) {
// Hide the widget, it should have sent out a message to the renderer. // Hide the widget, it should have sent out a message to the renderer.
EXPECT_FALSE(host_->is_hidden_); EXPECT_FALSE(host_->is_hidden_);
host_->WasHidden(); host_->WasHidden();
...@@ -1224,13 +1224,8 @@ TEST_F(RenderWidgetHostTest, HiddenPaint) { ...@@ -1224,13 +1224,8 @@ TEST_F(RenderWidgetHostTest, HiddenPaint) {
host_->WasShown(false /* record_presentation_time */); host_->WasShown(false /* record_presentation_time */);
EXPECT_FALSE(host_->is_hidden_); EXPECT_FALSE(host_->is_hidden_);
// It should have sent out a restored message with a request to paint. // It should have sent out a restored message.
const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_WasShown::ID));
ViewMsg_WasShown::ID);
ASSERT_TRUE(restored);
std::tuple<bool, base::TimeTicks> needs_repaint;
ViewMsg_WasShown::Read(restored, &needs_repaint);
EXPECT_TRUE(std::get<0>(needs_repaint));
} }
TEST_F(RenderWidgetHostTest, IgnoreKeyEventsHandledByRenderer) { TEST_F(RenderWidgetHostTest, IgnoreKeyEventsHandledByRenderer) {
......
...@@ -266,8 +266,7 @@ IPC_MESSAGE_ROUTED0(ViewMsg_WasHidden) ...@@ -266,8 +266,7 @@ IPC_MESSAGE_ROUTED0(ViewMsg_WasHidden)
// render view is expected to respond with a full repaint if needs_repainting // render view is expected to respond with a full repaint if needs_repainting
// is true. If needs_repainting is false, then this message does not trigger a // is true. If needs_repainting is false, then this message does not trigger a
// message in response. // message in response.
IPC_MESSAGE_ROUTED2(ViewMsg_WasShown, IPC_MESSAGE_ROUTED1(ViewMsg_WasShown,
bool /* needs_repainting */,
base::TimeTicks /* show_request_timestamp */) base::TimeTicks /* show_request_timestamp */)
// Tells the renderer to focus the first (last if reverse is true) focusable // Tells the renderer to focus the first (last if reverse is true) focusable
......
...@@ -211,7 +211,7 @@ TEST_F(RenderFrameImplTest, FrameResize) { ...@@ -211,7 +211,7 @@ TEST_F(RenderFrameImplTest, FrameResize) {
TEST_F(RenderFrameImplTest, FrameWasShown) { TEST_F(RenderFrameImplTest, FrameWasShown) {
RenderFrameTestObserver observer(frame()); RenderFrameTestObserver observer(frame());
ViewMsg_WasShown was_shown_message(0, true, base::TimeTicks()); ViewMsg_WasShown was_shown_message(0, base::TimeTicks());
frame_widget()->OnMessageReceived(was_shown_message); frame_widget()->OnMessageReceived(was_shown_message);
EXPECT_FALSE(frame_widget()->is_hidden()); EXPECT_FALSE(frame_widget()->is_hidden());
...@@ -241,7 +241,7 @@ TEST_F(RenderFrameImplTest, LocalChildFrameWasShown) { ...@@ -241,7 +241,7 @@ TEST_F(RenderFrameImplTest, LocalChildFrameWasShown) {
RenderFrameTestObserver observer(grandchild); RenderFrameTestObserver observer(grandchild);
ViewMsg_WasShown was_shown_message(0, true, base::TimeTicks()); ViewMsg_WasShown was_shown_message(0, base::TimeTicks());
frame_widget()->OnMessageReceived(was_shown_message); frame_widget()->OnMessageReceived(was_shown_message);
EXPECT_FALSE(frame_widget()->is_hidden()); EXPECT_FALSE(frame_widget()->is_hidden());
...@@ -254,7 +254,7 @@ TEST_F(RenderFrameImplTest, FrameWasShownAfterWidgetClose) { ...@@ -254,7 +254,7 @@ TEST_F(RenderFrameImplTest, FrameWasShownAfterWidgetClose) {
ViewMsg_Close close_message(0); ViewMsg_Close close_message(0);
frame_widget()->OnMessageReceived(close_message); frame_widget()->OnMessageReceived(close_message);
ViewMsg_WasShown was_shown_message(0, true, base::TimeTicks()); ViewMsg_WasShown was_shown_message(0, base::TimeTicks());
// Test passes if this does not crash. // Test passes if this does not crash.
RenderWidget* render_widget = RenderWidget* render_widget =
static_cast<RenderViewImpl*>(view_)->GetWidget(); static_cast<RenderViewImpl*>(view_)->GetWidget();
......
...@@ -803,8 +803,7 @@ void RenderWidget::OnWasHidden() { ...@@ -803,8 +803,7 @@ void RenderWidget::OnWasHidden() {
observer.WasHidden(); observer.WasHidden();
} }
void RenderWidget::OnWasShown(bool needs_repainting, void RenderWidget::OnWasShown(base::TimeTicks show_request_timestamp) {
base::TimeTicks show_request_timestamp) {
TRACE_EVENT0("renderer", "RenderWidget::OnWasShown"); TRACE_EVENT0("renderer", "RenderWidget::OnWasShown");
// During shutdown we can just ignore this message. // During shutdown we can just ignore this message.
if (!GetWebWidget()) if (!GetWebWidget())
...@@ -816,9 +815,6 @@ void RenderWidget::OnWasShown(bool needs_repainting, ...@@ -816,9 +815,6 @@ void RenderWidget::OnWasShown(bool needs_repainting,
for (auto& observer : render_frames_) for (auto& observer : render_frames_)
observer.WasShown(); observer.WasShown();
if (!needs_repainting)
return;
if (layer_tree_view_ && !show_request_timestamp.is_null()) { if (layer_tree_view_ && !show_request_timestamp.is_null()) {
layer_tree_view_->layer_tree_host()->RequestPresentationTimeForNextFrame( layer_tree_view_->layer_tree_host()->RequestPresentationTimeForNextFrame(
CreateTabSwitchingTimeRecorder(show_request_timestamp)); CreateTabSwitchingTimeRecorder(show_request_timestamp));
......
...@@ -601,8 +601,7 @@ class CONTENT_EXPORT RenderWidget ...@@ -601,8 +601,7 @@ class CONTENT_EXPORT RenderWidget
void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params); void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
void OnDisableDeviceEmulation(); void OnDisableDeviceEmulation();
void OnWasHidden(); void OnWasHidden();
void OnWasShown(bool needs_repainting, void OnWasShown(base::TimeTicks show_request_timestamp);
base::TimeTicks show_request_timestamp);
void OnCreateVideoAck(int32_t video_id); void OnCreateVideoAck(int32_t video_id);
void OnUpdateVideoAck(int32_t video_id); void OnUpdateVideoAck(int32_t video_id);
void OnRequestSetBoundsAck(); void OnRequestSetBoundsAck();
......
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