summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/layer_tree_host.cc9
-rw-r--r--cc/layer_tree_host_impl.cc19
-rw-r--r--cc/layer_tree_host_impl.h4
-rw-r--r--cc/layer_tree_host_impl_unittest.cc2
-rw-r--r--cc/layer_tree_impl.cc17
-rw-r--r--cc/layer_tree_impl.h6
-rw-r--r--cc/single_thread_proxy.cc6
-rw-r--r--cc/thread_proxy.cc10
8 files changed, 38 insertions, 35 deletions
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index ca49b10..62f3995 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -254,6 +254,10 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
{
DCHECK(m_proxy->isImplThread());
+ // If there are linked evicted backings, these backings' resources may be put into the
+ // impl tree, so we can't draw yet. Determine this before clearing all evicted backings.
+ bool newImplTreeHasNoEvictedResources = !m_contentsTextureManager->linkedEvictedBackingsExist();
+
m_contentsTextureManager->updateBackingsInDrawingImplTree();
m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider());
@@ -306,6 +310,11 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
hostImpl->setDebugState(m_debugState);
hostImpl->savePaintTime(m_renderingStats.totalPaintTime);
+ if (newImplTreeHasNoEvictedResources) {
+ if (syncTree->ContentsTexturesPurged())
+ syncTree->ResetContentsTexturesPurged();
+ }
+
m_commitNumber++;
}
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 797b46d..9956f555 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -136,7 +136,6 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
, m_debugState(settings.initialDebugState)
, m_deviceScaleFactor(1)
, m_visible(true)
- , m_contentsTexturesPurged(false)
, m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationLimit(),
ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
0,
@@ -219,7 +218,7 @@ bool LayerTreeHostImpl::canDraw()
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer");
return false;
}
- if (m_contentsTexturesPurged) {
+ if (m_activeTree->ContentsTexturesPurged()) {
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures purged");
return false;
}
@@ -698,7 +697,9 @@ void LayerTreeHostImpl::enforceManagedMemoryPolicy(const ManagedMemoryPolicy& po
ManagedMemoryPolicy::priorityCutoffToValue(
m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible));
if (evictedResources) {
- setContentsTexturesPurged();
+ activeTree()->SetContentsTexturesPurged();
+ if (pendingTree())
+ pendingTree()->SetContentsTexturesPurged();
m_client->setNeedsCommitOnImplThread();
m_client->onCanDrawStateChanged(canDraw());
}
@@ -1028,18 +1029,6 @@ bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurfa
return true;
}
-void LayerTreeHostImpl::setContentsTexturesPurged()
-{
- m_contentsTexturesPurged = true;
- m_client->onCanDrawStateChanged(canDraw());
-}
-
-void LayerTreeHostImpl::resetContentsTexturesPurged()
-{
- m_contentsTexturesPurged = false;
- m_client->onCanDrawStateChanged(canDraw());
-}
-
void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
{
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index 3d92dc4..79c6164 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -174,9 +174,6 @@ public:
bool visible() const { return m_visible; }
void setVisible(bool);
- bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
- void setContentsTexturesPurged();
- void resetContentsTexturesPurged();
size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
@@ -320,7 +317,6 @@ private:
gfx::Size m_deviceViewportSize;
float m_deviceScaleFactor;
bool m_visible;
- bool m_contentsTexturesPurged;
ManagedMemoryPolicy m_managedMemoryPolicy;
bool m_needsUpdateDrawProperties;
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 459ab4bb..32f0b48 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -283,7 +283,7 @@ TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged)
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
- m_hostImpl->resetContentsTexturesPurged();
+ m_hostImpl->activeTree()->ResetContentsTexturesPurged();
EXPECT_TRUE(m_hostImpl->canDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 769639a..ad22981 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -19,7 +19,8 @@ LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
, currently_scrolling_layer_(0)
, background_color_(0)
, has_transparent_background_(false)
- , scrolling_layer_id_from_previous_tree_(0) {
+ , scrolling_layer_id_from_previous_tree_(0)
+ , contents_textures_purged_(false) {
}
LayerTreeImpl::~LayerTreeImpl() {
@@ -215,6 +216,20 @@ void LayerTreeImpl::DidBecomeActive() {
DidBecomeActiveRecursive(RootLayer());
}
+bool LayerTreeImpl::ContentsTexturesPurged() const {
+ return contents_textures_purged_;
+}
+
+void LayerTreeImpl::SetContentsTexturesPurged() {
+ contents_textures_purged_ = true;
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+}
+
+void LayerTreeImpl::ResetContentsTexturesPurged() {
+ contents_textures_purged_ = false;
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+}
+
const LayerTreeSettings& LayerTreeImpl::settings() const {
return layer_tree_host_impl_->settings();
}
diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h
index e83647b..71f8c9b 100644
--- a/cc/layer_tree_impl.h
+++ b/cc/layer_tree_impl.h
@@ -137,6 +137,10 @@ class CC_EXPORT LayerTreeImpl {
void DidBecomeActive();
+ bool ContentsTexturesPurged() const;
+ void SetContentsTexturesPurged();
+ void ResetContentsTexturesPurged();
+
protected:
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl);
@@ -159,6 +163,8 @@ protected:
// rendering and input event hit testing.
LayerList render_surface_layer_list_;
+ bool contents_textures_purged_;
+
DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
};
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 1dc1e6b..f4b7f29 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -7,6 +7,7 @@
#include "base/debug/trace_event.h"
#include "cc/draw_quad.h"
#include "cc/layer_tree_host.h"
+#include "cc/layer_tree_impl.h"
#include "cc/output_surface.h"
#include "cc/prioritized_resource_manager.h"
#include "cc/resource_update_controller.h"
@@ -257,7 +258,7 @@ void SingleThreadProxy::stop()
DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
DebugScopedSetImplThread impl(this);
- if (!m_layerTreeHostImpl->contentsTexturesPurged())
+ if (!m_layerTreeHostImpl->activeTree()->ContentsTexturesPurged())
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
m_layerTreeHostImpl.reset();
}
@@ -344,9 +345,6 @@ bool SingleThreadProxy::commitAndComposite()
scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue);
m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAllocationLimitBytes());
- if (m_layerTreeHostImpl->contentsTexturesPurged())
- m_layerTreeHostImpl->resetContentsTexturesPurged();
-
m_layerTreeHost->willCommit();
doCommit(queue.Pass());
bool result = doComposite();
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index ea763c5..6e27362 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -704,19 +704,9 @@ void ThreadProxy::scheduledActionCommit()
m_currentResourceUpdateControllerOnImplThread->finalize();
m_currentResourceUpdateControllerOnImplThread.reset();
- // If there are linked evicted backings, these backings' resources may be put into the
- // impl tree, so we can't draw yet. Determine this before clearing all evicted backings.
- bool newImplTreeHasNoEvictedResources = !m_layerTreeHost->contentsTextureManager()->linkedEvictedBackingsExist();
-
m_layerTreeHostImpl->beginCommit();
m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
-
- if (newImplTreeHasNoEvictedResources) {
- if (m_layerTreeHostImpl->contentsTexturesPurged())
- m_layerTreeHostImpl->resetContentsTexturesPurged();
- }
-
m_layerTreeHostImpl->commitComplete();
m_nextFrameIsNewlyCommittedFrameOnImplThread = true;