Commit 952a0927 authored by Alex Rudenko's avatar Alex Rudenko Committed by Commit Bot

Remove rendering throttling in inspector overlay

Previously [1], we introduced throttling for painting the inspector
overlay to reduce cpu usage on frequently updated pages. With new
persistent overlays, this results in a rendering lag when scrolling
the page. Therefore, this CL removes throttling to improve
performance when scrolling. We will be still looking for better
architecture to support smooth scrolling and low CPU usage.

[1]: https://chromium-review.googlesource.com/c/chromium/src/+/2202858

Bug: 1062574
Change-Id: I15bec84aaf525f6ede236c82d0a4fe1ffd234317
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416294Reviewed-by: default avatarMathias Bynens <mathias@chromium.org>
Reviewed-by: default avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808836}
parent 1e9b7645
...@@ -1000,21 +1000,6 @@ void InspectorOverlayAgent::PaintOverlayPage() { ...@@ -1000,21 +1000,6 @@ void InspectorOverlayAgent::PaintOverlayPage() {
if (!view || !frame) if (!view || !frame)
return; return;
// Throttling rendering to avoid high CPU usage on highly active pages
// (animations). If force_overlay_paint_ is true, we rerender even if the last
// paint was less than 50ms ago.
auto now = base::Time::Now();
if (!force_overlay_paint_ &&
now - last_paint_time_ < base::TimeDelta::FromMilliseconds(50)) {
OverlayMainFrame()->View()->UpdateAllLifecyclePhases(
DocumentUpdateReason::kInspector);
return;
}
if (force_overlay_paint_) {
force_overlay_paint_ = false;
}
last_paint_time_ = now;
LocalFrame* overlay_frame = OverlayMainFrame(); LocalFrame* overlay_frame = OverlayMainFrame();
// To make overlay render the same size text with any emulation scale, // To make overlay render the same size text with any emulation scale,
// compensate the emulation scale using page scale. // compensate the emulation scale using page scale.
...@@ -1302,7 +1287,6 @@ void InspectorOverlayAgent::Inspect(Node* inspected_node) { ...@@ -1302,7 +1287,6 @@ void InspectorOverlayAgent::Inspect(Node* inspected_node) {
DOMNodeId backend_node_id = DOMNodeIds::IdForNode(node); DOMNodeId backend_node_id = DOMNodeIds::IdForNode(node);
if (!enabled_.Get()) { if (!enabled_.Get()) {
backend_node_id_to_inspect_ = backend_node_id; backend_node_id_to_inspect_ = backend_node_id;
force_overlay_paint_ = true;
return; return;
} }
...@@ -1403,7 +1387,6 @@ void InspectorOverlayAgent::SetInspectTool(InspectTool* inspect_tool) { ...@@ -1403,7 +1387,6 @@ void InspectorOverlayAgent::SetInspectTool(InspectTool* inspect_tool) {
if (!hinge_) if (!hinge_)
DisableFrameOverlay(); DisableFrameOverlay();
} }
force_overlay_paint_ = true;
ScheduleUpdate(); ScheduleUpdate();
} }
......
...@@ -302,8 +302,6 @@ class CORE_EXPORT InspectorOverlayAgent final ...@@ -302,8 +302,6 @@ class CORE_EXPORT InspectorOverlayAgent final
InspectorAgentState::String paused_in_debugger_message_; InspectorAgentState::String paused_in_debugger_message_;
InspectorAgentState::String inspect_mode_; InspectorAgentState::String inspect_mode_;
InspectorAgentState::Bytes inspect_mode_protocol_config_; InspectorAgentState::Bytes inspect_mode_protocol_config_;
base::Time last_paint_time_;
bool force_overlay_paint_;
DISALLOW_COPY_AND_ASSIGN(InspectorOverlayAgent); DISALLOW_COPY_AND_ASSIGN(InspectorOverlayAgent);
}; };
......
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