Commit 2ac1c763 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Skip IsReadyToActivate in TileManager::IssueSignals() if no pending tree

We build raster queues for both pending layers and active layers when
checking IsReadyToActivate() in issuing signals. If there is no pending
tree from the TileManageClient, we can save the CPU time by skipping
IsReadyToActivate().

Bug: 880190
Change-Id: Iac2e162ffb1d462cd3a3168cfed7c22363013537
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505115Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822223}
parent b557fb77
......@@ -43,4 +43,8 @@ int FakeTileManagerClient::GetMSAASampleCountForRaster(
return 0;
}
bool FakeTileManagerClient::HasPendingTree() {
return true;
}
} // namespace cc
......@@ -36,6 +36,7 @@ class FakeTileManagerClient : public TileManagerClient {
WhichTree tree) const override;
int GetMSAASampleCountForRaster(
const scoped_refptr<DisplayItemList>& display_list) override;
bool HasPendingTree() override;
private:
gfx::ColorSpace color_space_;
......
......@@ -1496,7 +1496,7 @@ void TileManager::IssueSignals() {
if (signals_.activate_tile_tasks_completed &&
signals_.activate_gpu_work_completed &&
!signals_.did_notify_ready_to_activate) {
if (IsReadyToActivate()) {
if (!client_->HasPendingTree() || IsReadyToActivate()) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
"TileManager::IssueSignals - ready to activate");
signals_.did_notify_ready_to_activate = true;
......
......@@ -104,6 +104,9 @@ class CC_EXPORT TileManagerClient {
virtual int GetMSAASampleCountForRaster(
const scoped_refptr<DisplayItemList>& display_list) = 0;
// True if there is a pending tree.
virtual bool HasPendingTree() = 0;
protected:
virtual ~TileManagerClient() {}
};
......
......@@ -1851,6 +1851,10 @@ int LayerTreeHostImpl::GetMSAASampleCountForRaster(
return RequestedMSAASampleCount();
}
bool LayerTreeHostImpl::HasPendingTree() {
return pending_tree_ != nullptr;
}
void LayerTreeHostImpl::NotifyReadyToActivate() {
// The TileManager may call this method while the pending tree is still being
// painted, as it isn't aware of the ongoing paint. We shouldn't tell the
......
......@@ -494,6 +494,8 @@ class CC_EXPORT LayerTreeHostImpl : public TileManagerClient,
int GetMSAASampleCountForRaster(
const scoped_refptr<DisplayItemList>& display_list) override;
bool HasPendingTree() override;
// ScrollbarAnimationControllerClient implementation.
void PostDelayedScrollbarAnimationTask(base::OnceClosure task,
base::TimeDelta delay) override;
......
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