New issue
Advanced search Search tips

Issue 896356 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 3
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 1
Type: Bug



Sign in to add a comment

Lifecycle updates occur multiple times within BeginMainFrame

Project Member Reported by schenney@chromium.org, Oct 17

Issue description

Chrome Version: ToT
OS: Confirmed WIndows and Linux, probably all

What steps will reproduce the problem?
(1) Add code to catch recursion in the various UMA and UKM recording code in local_frame-view.
(2) Note that we hit the checks a lot. Also, UMA results showed a big jump in times when UMA reporting aggegrated all BeginMainFrame work, suggested we do Style,Layout,PrePaint,Paint and COmpositing multiple times per frame, sometimes.

What is the expected result?
There is absolutely no reason to paint more than once for a given frame in a given main frame time (or at least very rare reasons). Style and Layout does need to be done for some size negotiations, but painting is not required for that.

What happens instead?
We do more than one of everything inside UpdateLifecycle*.
 
Could it be due to forced lifecycles during hit testing or script event handers?

ResizeObserver does recursive layouts, but should not recurse into multiple UMA points.

Have you tried writing a patch with DCHECKs and running through the CQ?
Status: Assigned (was: Available)
I added a test that this does not occur (lifecycle/background-change-lifecycle-count.html) but it is currently failing due to the mouse hover timer. This is partially tracked in https://crbug.com/875884. If there are more cases where this is occurring, we can use a similar approach to add a test to ensure it doesn't regress.
I've run a patch locally but it fails checks immediately due to multiple StyleAndLayout updates on startup. These are legit due to size negotiation of some kind, I think.

Tracking it down is complicated by the fact that this seems to cycle back via messages or at least "DidBlahBlah" calls into the proxy_main code, I think.

Anyone, tomorrow I'll get into it and figure out all the places it happens.

Turns out we were never calling RecordEndOfFrameMetrics for OOPIF because the virtual override was missing for WebFrameWidget. That accounts for the apparent multiple main frame lifecycle updates. Still, there are some seemingly over zealous lifecycle updates.

On Mac:

void WebViewImpl::ResizeViewWhileAnchored(...) updates all lifecycles. The comment seems to suggests this is called when the orientation changes in WebView, but it's also called at startup when painting need not be updated. Still, if this does the work of first frame painting and nothing is dirty in theory we shouldn't do anything when we actually try to update the frame, right?

void ValidationMessageOverlayDelegate::EnsurePage
This says it is getting a size, so only needs to go to kLayout, not all.


Project Member

Comment 6 by bugdroid1@chromium.org, Nov 21

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ec431261dbbbeccd6056339ba49c476867e3d59f

commit ec431261dbbbeccd6056339ba49c476867e3d59f
Author: Stephen Chenney <schenney@chromium.org>
Date: Wed Nov 21 12:40:16 2018

Record main-frame-time-ratio metrics only when in a main frame update

We were recording main frame time metrics even when doing lifecycle
updates for other reasons, which is pointless and skews the numbers.
This plumbs information on the source of the update through necessary
layers.

R=pdr@chromium.org
BUG= 896356 

Change-Id: I94ec6ec14a6629ec2295b4575e9af7a8fd5b7ead
Reviewed-on: https://chromium-review.googlesource.com/c/1303874
Reviewed-by: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: vmpstr <vmpstr@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610014}
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/test/layer_tree_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/test/stub_layer_tree_host_client.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/trees/layer_tree_host.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/trees/layer_tree_host.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/trees/layer_tree_host_client.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/trees/proxy_main.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/cc/trees/single_thread_proxy.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/chrome/renderer/chrome_render_frame_observer_browsertest.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/components/plugins/renderer/webview_plugin.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/components/plugins/renderer/webview_plugin.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/browser/renderer_host/compositor_impl_android.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/browser/renderer_host/compositor_impl_android.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/public/test/render_view_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/browser_plugin/browser_plugin.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/gpu/layer_tree_view.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/gpu/layer_tree_view.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/gpu/layer_tree_view_delegate.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/pepper/pepper_webplugin_impl.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/render_view_impl.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/render_widget.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/renderer/render_widget.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/shell/renderer/layout_test/blink_test_runner.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/shell/test_runner/event_sender.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/shell/test_runner/pixel_dump.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/shell/test_runner/test_plugin.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/content/test/stub_layer_tree_view_delegate.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/public/web/web_plugin.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/public/web/web_widget.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/animation/compositor_animations_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/css/css_paint_value_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/css/drag_update_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/css/style_engine_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/css/style_environment_variables_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/dom/document_lifecycle.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/dom/element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/editing/finder/text_finder_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/editing/testing/editing_test_base.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_frame_content_dumper.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_frame_serializer_sanitization_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_frame_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_layer_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_page_popup_impl.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_page_popup_impl.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_plugin_container_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_view_impl.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_view_impl.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/exported/web_view_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/browser_controls_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/local_frame_view.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/local_frame_view.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/use_counter_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/visual_viewport_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/web_frame_widget_impl.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/web_view_frame_widget.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/frame/web_view_frame_widget.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/forms/external_popup_menu_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/forms/password_input_type_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/forms/text_control_element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/html_content_element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/html_object_element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/html_slot_element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/html/shadow/progress_shadow_element_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/input/gesture_manager.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/inspector/main_thread_debugger_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/jank_tracker_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/layout_geometry_map_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/layout_object_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/layout_table_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/map_coordinates_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/layout/scrollbars_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/loader/programmatic_scroll_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/context_menu_controller_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/page_animator.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/page_animator.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/page_overlay_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/page_widget_delegate.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/page_widget_delegate.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/scrolling/scroll_metrics_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/spatial_navigation_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/validation_message_overlay_delegate.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/page/viewport_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/paint_property_tree_update_tests.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/paint/view_painter_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/scheduler/frame_throttling_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/testing/fake_web_plugin.h
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/testing/internals.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/testing/page_test_base.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/core/testing/sim/sim_compositor.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/third_party/blink/renderer/modules/wake_lock/screen_wake_lock_test.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/ui/compositor/compositor.cc
[modify] https://crrev.com/ec431261dbbbeccd6056339ba49c476867e3d59f/ui/compositor/compositor.h

Status: Fixed (was: Assigned)

Sign in to add a comment