summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_impl.cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 01:58:35 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 01:58:35 +0000
commitff1211d9aee45ac4a75cfeb61dcc1b95c9c3f45e (patch)
tree59ef85af047a277de91a77bb6f6e0525b8de631c /cc/trees/layer_tree_host_impl.cc
parentcb67080199d7b917ac4217889e3ad5c3ba905d8a (diff)
downloadchromium_src-ff1211d9aee45ac4a75cfeb61dcc1b95c9c3f45e.zip
chromium_src-ff1211d9aee45ac4a75cfeb61dcc1b95c9c3f45e.tar.gz
chromium_src-ff1211d9aee45ac4a75cfeb61dcc1b95c9c3f45e.tar.bz2
Revert 204221 "cc: Make all layer recursion use CallFunctionForS..."
> cc: Make all layer recursion use CallFunctionForSubtree > > This is mostly a cleanup that I noticed while doing other code. > > The behavior change here is that SetNeedsDisplay and DidBecomeActive is > now called for all mask and replica layers. > > Also, refactor CallFunctionForSubtree so that both functors and > functions can be passed to it. As no uses in the codebase actually > needed function objects with state, turn them all into simpler static > functions. > > R=danakj@chromium.org > BUG=239614 > > Review URL: https://chromiumcodereview.appspot.com/15959012 TBR=enne@chromium.org BUG=247349 Review URL: https://chromiumcodereview.appspot.com/16553003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/layer_tree_host_impl.cc')
-rw-r--r--cc/trees/layer_tree_host_impl.cc55
1 files changed, 30 insertions, 25 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 5d84fcd..2b8d453 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1109,9 +1109,12 @@ bool LayerTreeHostImpl::AllowPartialSwap() const {
return !debug_state_.ShowHudRects();
}
-void DidBeginTracing(LayerImpl* layer) {
- layer->DidBeginTracing();
-}
+class DidBeginTracingFunctor {
+ public:
+ void operator()(LayerImpl* layer) {
+ layer->DidBeginTracing();
+ }
+};
void LayerTreeHostImpl::DrawLayers(FrameData* frame,
base::TimeTicks frame_begin_time) {
@@ -1153,12 +1156,13 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
bool is_new_trace;
TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
if (is_new_trace) {
- if (pending_tree_) {
- LayerTreeHostCommon::CallFunctionForSubtree(DidBeginTracing,
- pending_tree_->root_layer());
- }
- LayerTreeHostCommon::CallFunctionForSubtree(DidBeginTracing,
- active_tree_->root_layer());
+ if (pending_tree_)
+ LayerTreeHostCommon::CallFunctionForSubtree<
+ DidBeginTracingFunctor, LayerImpl>(
+ pending_tree_->root_layer());
+ LayerTreeHostCommon::CallFunctionForSubtree<
+ DidBeginTracingFunctor, LayerImpl>(
+ active_tree_->root_layer());
}
TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
@@ -1425,10 +1429,6 @@ ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const {
return actual;
}
-static void LostOutputSurface(LayerImpl* layer) {
- layer->DidLoseOutputSurface();
-}
-
bool LayerTreeHostImpl::InitializeRenderer(
scoped_ptr<OutputSurface> output_surface) {
// Since we will create a new resource provider, we cannot continue to use
@@ -1436,18 +1436,12 @@ bool LayerTreeHostImpl::InitializeRenderer(
// before we destroy the old resource provider.
if (active_tree_->root_layer())
ClearRenderSurfaces();
- if (active_tree_->root_layer()) {
- LayerTreeHostCommon::CallFunctionForSubtree(LostOutputSurface,
- active_tree_->root_layer());
- }
- if (pending_tree_ && pending_tree_->root_layer()) {
- LayerTreeHostCommon::CallFunctionForSubtree(LostOutputSurface,
- pending_tree_->root_layer());
- }
- if (recycle_tree_ && recycle_tree_->root_layer()) {
- LayerTreeHostCommon::CallFunctionForSubtree(LostOutputSurface,
- recycle_tree_->root_layer());
- }
+ if (active_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(active_tree_->root_layer());
+ if (pending_tree_ && pending_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(pending_tree_->root_layer());
+ if (recycle_tree_ && recycle_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(recycle_tree_->root_layer());
if (resource_provider_)
resource_provider_->DidLoseOutputSurface();
@@ -2077,6 +2071,17 @@ base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const {
return base::TimeDelta::FromSeconds(1);
}
+void LayerTreeHostImpl::SendDidLoseOutputSurfaceRecursive(LayerImpl* current) {
+ DCHECK(current);
+ current->DidLoseOutputSurface();
+ if (current->mask_layer())
+ SendDidLoseOutputSurfaceRecursive(current->mask_layer());
+ if (current->replica_layer())
+ SendDidLoseOutputSurfaceRecursive(current->replica_layer());
+ for (size_t i = 0; i < current->children().size(); ++i)
+ SendDidLoseOutputSurfaceRecursive(current->children()[i]);
+}
+
void LayerTreeHostImpl::ClearRenderSurfaces() {
active_tree_->ClearRenderSurfaces();
if (pending_tree_)