Commit 047c361c authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Defer location change events and processing during page load

Improves speed of page load stress test from 146 seconds to 43 seconds.

Also add logging for accessibility page load speed.

Bug: 976849
Change-Id: I51d2833366b7b54b2abb9fde40811d29ef287aef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1675917
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672315}
parent 7d9179db
......@@ -192,6 +192,7 @@ void RenderAccessibilityImpl::DidCreateNewDocument() {
void RenderAccessibilityImpl::DidCommitProvisionalLoad(
bool is_same_document_navigation,
ui::PageTransition transition) {
is_initial_load_processed_ = false;
has_injected_stylesheet_ = false;
// Remove the image annotator if the page is loading and it was added for
// the one-shot image annotation (i.e. AXMode for image annotation is not
......@@ -603,6 +604,8 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() {
// ids to locations.
for (size_t j = 0; j < update.nodes.size(); ++j) {
ui::AXNodeData& src = update.nodes[j];
// TODO(accessibility) What if location hasn't been set yet?
// Get cached location for this node or create a new entry if none exists.
ui::AXRelativeBounds& dst = locations_[update.nodes[j].id];
dst = src.relative_bounds;
}
......@@ -622,11 +625,13 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() {
ack_token_));
reset_token_ = 0;
if (had_layout_complete_messages)
if (had_layout_complete_messages && is_initial_load_processed_)
SendLocationChanges();
if (had_load_complete_messages)
if (had_load_complete_messages) {
has_injected_stylesheet_ = false;
is_initial_load_processed_ = true;
}
if (image_annotation_debugging_)
AddImageAnnotationDebuggingAttributes(bundle.updates);
......
......@@ -236,6 +236,9 @@ class CONTENT_EXPORT RenderAccessibilityImpl
// for debugging.
bool image_annotation_debugging_ = false;
// Has all data related to the initial page load been processed.
bool is_initial_load_processed_ = false;
// So we can queue up tasks to be executed later.
base::WeakPtrFactory<RenderAccessibilityImpl> weak_factory_;
......
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