summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 13:20:04 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 13:20:04 +0000
commit94bf75cc405b787a6643aa329a5e4f5eab9ad696 (patch)
tree0ff2aa53f45dfba1c00d8a71d781cd5752a49141 /cc
parentdf665316903111d1d0b31a41b26b3bc7946cbe63 (diff)
downloadchromium_src-94bf75cc405b787a6643aa329a5e4f5eab9ad696.zip
chromium_src-94bf75cc405b787a6643aa329a5e4f5eab9ad696.tar.gz
chromium_src-94bf75cc405b787a6643aa329a5e4f5eab9ad696.tar.bz2
cc: Make activation happen as soon as possible
Rather than periodically trying to activate, allow the tile manager to send a notification that activation is ready. Additionally, activation can happen immediately during commit. If there are no animations and the LTHI is not in prefer smoothness mode, then the tree will activate immediately after rasterization as all the uploads will be forced. If uploads are not forced, the tile manager will periodically be polled via ActivatePendingTreeIfNeeded(). This can be improved in the future via scheduling changes. R=danakj@chromium.org BUG=236648 Review URL: https://chromiumcodereview.appspot.com/15777004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/resources/tile_manager.cc7
-rw-r--r--cc/resources/tile_manager.h1
-rw-r--r--cc/test/fake_tile_manager_client.h1
-rw-r--r--cc/test/layer_tree_test.cc27
-rw-r--r--cc/test/layer_tree_test.h3
-rw-r--r--cc/trees/layer_tree_host_impl.cc47
-rw-r--r--cc/trees/layer_tree_host_impl.h5
-rw-r--r--cc/trees/layer_tree_host_unittest.cc14
-rw-r--r--cc/trees/layer_tree_host_unittest_animation.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc4
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc20
-rw-r--r--cc/trees/layer_tree_host_unittest_picture.cc4
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc4
-rw-r--r--cc/trees/thread_proxy.cc17
15 files changed, 99 insertions, 59 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index ad98a9a..46f38fb 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -293,6 +293,10 @@ void TileManager::ManageTiles() {
SortTiles();
AssignGpuMemoryToTiles();
+ // This could have changed after AssignGpuMemoryToTiles.
+ if (AreTilesRequiredForActivationReady())
+ client_->NotifyReadyToActivate();
+
TRACE_EVENT_INSTANT1(
"cc", "DidManage", TRACE_EVENT_SCOPE_THREAD,
"state", TracedValue::FromValue(BasicStateAsValue().release()));
@@ -815,6 +819,9 @@ void TileManager::DidFinishTileInitialization(Tile* tile) {
// if it was marked as being required after being dispatched for
// rasterization but before AssignGPUMemory was called again.
tiles_that_need_to_be_initialized_for_activation_.erase(tile);
+
+ if (AreTilesRequiredForActivationReady())
+ client_->NotifyReadyToActivate();
}
}
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index 7d3cb2a..bacb30b 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -40,6 +40,7 @@ class CC_EXPORT TileManagerClient {
virtual void DidInitializeVisibleTile() = 0;
virtual bool
ShouldForceTileUploadsRequiredForActivationToComplete() const = 0;
+ virtual void NotifyReadyToActivate() = 0;
protected:
virtual ~TileManagerClient() {}
diff --git a/cc/test/fake_tile_manager_client.h b/cc/test/fake_tile_manager_client.h
index a031d8f..743f1b3 100644
--- a/cc/test/fake_tile_manager_client.h
+++ b/cc/test/fake_tile_manager_client.h
@@ -17,6 +17,7 @@ class FakeTileManagerClient : public TileManagerClient {
virtual void DidInitializeVisibleTile() OVERRIDE {}
virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const
OVERRIDE;
+ virtual void NotifyReadyToActivate() OVERRIDE {}
};
} // namespace cc
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 477a4ee..0bb17f346 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -81,8 +81,10 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
LayerTreeHostImpl::CommitComplete();
test_hooks_->CommitCompleteOnThread(this);
- if (!settings().impl_side_painting)
- test_hooks_->TreeActivatedOnThread(this);
+ if (!settings().impl_side_painting) {
+ test_hooks_->WillActivateTreeOnThread(this);
+ test_hooks_->DidActivateTreeOnThread(this);
+ }
}
virtual bool PrepareToDraw(FrameData* frame, gfx::Rect damage_rect) OVERRIDE {
@@ -109,17 +111,24 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
test_hooks_->SwapBuffersCompleteOnThread(this);
}
- virtual bool ActivatePendingTreeIfNeeded() OVERRIDE {
+ virtual void ActivatePendingTreeIfNeeded() OVERRIDE {
if (!pending_tree())
- return false;
+ return;
+
+ if (!test_hooks_->CanActivatePendingTree(this))
+ return;
+
+ LayerTreeHostImpl::ActivatePendingTreeIfNeeded();
+ }
+ virtual void ActivatePendingTree() OVERRIDE {
if (!test_hooks_->CanActivatePendingTree(this))
- return false;
+ return;
- bool activated = LayerTreeHostImpl::ActivatePendingTreeIfNeeded();
- if (activated)
- test_hooks_->TreeActivatedOnThread(this);
- return activated;
+ test_hooks_->WillActivateTreeOnThread(this);
+ LayerTreeHostImpl::ActivatePendingTree();
+ DCHECK(!pending_tree());
+ test_hooks_->DidActivateTreeOnThread(this);
}
virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface)
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index a7eb49d..856caaa 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -35,7 +35,8 @@ class TestHooks : public WebKit::WebAnimationDelegate {
virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {}
virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) {}
+ virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
bool success) {}
virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ec59dae..a497421 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -105,7 +105,16 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
new DebugScopedSetImplThread(layer_tree_host_impl_->proxy()));
}
- layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
+ // TODO(enne): This should probably happen post-animate.
+ if (layer_tree_host_impl_->pending_tree()) {
+ layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
+
+ if (layer_tree_host_impl_->pending_tree()) {
+ layer_tree_host_impl_->pending_tree()->UpdateDrawProperties();
+ layer_tree_host_impl_->ManageTiles();
+ }
+ }
+
layer_tree_host_impl_->Animate(
layer_tree_host_impl_->CurrentFrameTimeTicks(),
layer_tree_host_impl_->CurrentFrameTime());
@@ -1007,6 +1016,11 @@ bool LayerTreeHostImpl::
animation_registrar_->active_animation_controllers().empty();
}
+void LayerTreeHostImpl::NotifyReadyToActivate() {
+ if (pending_tree_)
+ ActivatePendingTree();
+}
+
bool LayerTreeHostImpl::ShouldClearRootRenderPass() const {
return settings_.should_clear_root_render_pass;
}
@@ -1329,31 +1343,26 @@ void LayerTreeHostImpl::CheckForCompletedTileUploads() {
tile_manager_->CheckForCompletedTileUploads();
}
-bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() {
- if (!pending_tree_)
- return false;
-
+void LayerTreeHostImpl::ActivatePendingTreeIfNeeded() {
+ DCHECK(pending_tree_);
CHECK(settings_.impl_side_painting);
- // TODO(enne): This needs to be moved somewhere else (post-animate?)
- pending_tree_->UpdateDrawProperties();
- // Note: This will likely cause ManageTiles to be needed. However,
- // it is only out of date as far as the last commit or the last draw.
- // For performance reasons, don't call ManageTiles again here.
+ // This call may activate the tree.
+ CheckForCompletedTileUploads();
+ if (!pending_tree_)
+ return;
+
+ // The tile manager is usually responsible for notifying activation.
+ // If there is no tile manager, then we need to manually activate.
+ if (!tile_manager_ || tile_manager_->AreTilesRequiredForActivationReady()) {
+ ActivatePendingTree();
+ return;
+ }
TRACE_EVENT_ASYNC_STEP1(
"cc",
"PendingTree", pending_tree_.get(), "activate",
"state", TracedValue::FromValue(ActivationStateAsValue().release()));
-
- if (tile_manager_) {
- tile_manager_->CheckForCompletedTileUploads();
- if (!tile_manager_->AreTilesRequiredForActivationReady())
- return false;
- }
-
- ActivatePendingTree();
- return true;
}
void LayerTreeHostImpl::ActivatePendingTree() {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index e05e45b..72c542d 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -199,6 +199,7 @@ class CC_EXPORT LayerTreeHostImpl
virtual void DidInitializeVisibleTile() OVERRIDE;
virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const
OVERRIDE;
+ virtual void NotifyReadyToActivate() OVERRIDE;
// OutputSurfaceClient implementation.
virtual bool DeferredInitialize(
@@ -243,7 +244,7 @@ class CC_EXPORT LayerTreeHostImpl
const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
virtual void CreatePendingTree();
void CheckForCompletedTileUploads();
- virtual bool ActivatePendingTreeIfNeeded();
+ virtual void ActivatePendingTreeIfNeeded();
// Shortcuts to layers on the active tree.
LayerImpl* RootLayer() const;
@@ -381,7 +382,7 @@ class CC_EXPORT LayerTreeHostImpl
LayerTreeHostImplClient* client,
Proxy* proxy,
RenderingStatsInstrumentation* rendering_stats_instrumentation);
- void ActivatePendingTree();
+ virtual void ActivatePendingTree();
// Virtual for testing.
virtual void AnimateLayers(base::TimeTicks monotonic_time,
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 5a92d0b..b8a2e9c 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -615,7 +615,7 @@ class LayerTreeHostTestCommit : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
EXPECT_EQ(gfx::Size(20, 20), impl->device_viewport_size());
EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color());
EXPECT_EQ(5.f, impl->active_tree()->page_scale_factor());
@@ -755,7 +755,7 @@ class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f);
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
impl->ProcessScrollDeltas();
// We get one commit before the first draw, and the animation doesn't happen
// until the second draw.
@@ -959,7 +959,7 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
// Should only do one commit.
EXPECT_EQ(0, impl->active_tree()->source_frame_number());
// Device scale factor should come over to impl.
@@ -1067,7 +1067,7 @@ class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
@@ -2111,7 +2111,7 @@ class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
EndTest();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
++num_commits_;
switch (num_commits_) {
case 1:
@@ -2339,7 +2339,7 @@ class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
EndTest();
}
@@ -2474,7 +2474,7 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
// In WillDraw, the IOSurfaceLayer sets up the io surface texture.
EXPECT_CALL(*mock_context_, activeTexture(_))
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 93ffb2e..c448002 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -462,7 +462,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
PostAddAnimationToMainThread(update_check_layer_.get());
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* animation_impl =
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 3b489eb..95cc88e 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -1034,8 +1034,8 @@ class LayerTreeHostContextTestLayersNotified
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- LayerTreeHostContextTest::TreeActivatedOnThread(host_impl);
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl);
FakeContentLayerImpl* root = static_cast<FakeContentLayerImpl*>(
host_impl->active_tree()->root_layer());
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 6823bc8..5ab3211 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -145,7 +145,7 @@ class LayerTreeHostDelegatedTestCreateChildId
gfx::Rect(0, 0, 1, 1)));
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
@@ -394,7 +394,7 @@ class LayerTreeHostDelegatedTestMergeResources
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
@@ -436,7 +436,7 @@ class LayerTreeHostDelegatedTestRemapResourcesInQuads
PostSetNeedsCommitToMainThread();
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
@@ -666,7 +666,7 @@ class LayerTreeHostDelegatedTestFrameBeforeAck
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() != 3)
return;
@@ -765,7 +765,7 @@ class LayerTreeHostDelegatedTestFrameBeforeTakeResources
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() != 3)
return;
@@ -872,7 +872,7 @@ class LayerTreeHostDelegatedTestBadFrame
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() < 1)
return;
@@ -985,7 +985,7 @@ class LayerTreeHostDelegatedTestUnnamedResource
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() != 1)
return;
@@ -1048,7 +1048,7 @@ class LayerTreeHostDelegatedTestDontLeakResource
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() != 1)
return;
@@ -1125,7 +1125,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() < 1)
return;
@@ -1245,7 +1245,7 @@ class LayerTreeHostDelegatedTestCommitWithoutTake
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() < 1)
return;
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc
index ce3cb2a..f9f302e 100644
--- a/cc/trees/layer_tree_host_unittest_picture.cc
+++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -52,7 +52,7 @@ class LayerTreeHostPictureTestTwinLayer
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void WillActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
LayerImpl* pending_root_impl = impl->pending_tree()->root_layer();
LayerImpl* active_root_impl = impl->active_tree()->root_layer();
@@ -88,7 +88,7 @@ class LayerTreeHostPictureTestTwinLayer
EXPECT_EQ(active_picture_impl, pending_picture_impl->twin_layer());
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
LayerImpl* active_root_impl = impl->active_tree()->root_layer();
if (active_root_impl->children().empty()) {
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index cd7868e..eef0e19 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -315,7 +315,7 @@ class LayerTreeHostScrollTestCaseWithChild
}
}
- virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
LayerImpl* root_impl = impl->active_tree()->root_layer();
LayerImpl* root_scroll_layer_impl = root_impl->children()[0];
LayerImpl* child_layer_impl = root_scroll_layer_impl->children()[0];
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 6180568..f0be762 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -367,11 +367,15 @@ bool LayerTreeImpl::ContentsTexturesPurged() const {
}
void LayerTreeImpl::SetContentsTexturesPurged() {
+ if (contents_textures_purged_)
+ return;
contents_textures_purged_ = true;
layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
void LayerTreeImpl::ResetContentsTexturesPurged() {
+ if (!contents_textures_purged_)
+ return;
contents_textures_purged_ = false;
layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 98512468..53db2c2 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -837,9 +837,11 @@ void ThreadProxy::ScheduledActionCommit() {
next_frame_is_newly_committed_frame_on_impl_thread_ = true;
if (layer_tree_host_->settings().impl_side_painting &&
- layer_tree_host_->BlocksPendingCommit()) {
+ layer_tree_host_->BlocksPendingCommit() &&
+ layer_tree_host_impl_->pending_tree()) {
// For some layer types in impl-side painting, the commit is held until
- // the pending tree is activated.
+ // the pending tree is activated. It's also possible that the
+ // pending tree has already activated if there was no work to be done.
TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD);
completion_event_for_commit_held_on_tree_activation_ =
commit_completion_event_on_impl_thread_;
@@ -877,8 +879,6 @@ ScheduledActionDrawAndSwapResult
ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap");
- base::AutoReset<bool> mark_inside(&inside_draw_, true);
-
ScheduledActionDrawAndSwapResult result;
result.did_draw = false;
result.did_swap = false;
@@ -895,10 +895,17 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
layer_tree_host_impl_->CurrentFrameTimeTicks();
base::Time wall_clock_time = layer_tree_host_impl_->CurrentFrameTime();
- layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
+ // TODO(enne): This should probably happen post-animate.
+ if (layer_tree_host_impl_->pending_tree()) {
+ layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
+ if (layer_tree_host_impl_->pending_tree())
+ layer_tree_host_impl_->pending_tree()->UpdateDrawProperties();
+ }
layer_tree_host_impl_->Animate(monotonic_time, wall_clock_time);
layer_tree_host_impl_->UpdateBackgroundAnimateTicking(false);
+ base::AutoReset<bool> mark_inside(&inside_draw_, true);
+
// This method is called on a forced draw, regardless of whether we are able
// to produce a frame, as the calling site on main thread is blocked until its
// request completes, and we signal completion here. If CanDraw() is false, we