Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "cc/animation_registrar.h" | 12 #include "cc/animation_registrar.h" |
| 13 #include "cc/font_atlas.h" | 13 #include "cc/font_atlas.h" |
| 14 #include "cc/heads_up_display_layer.h" | 14 #include "cc/heads_up_display_layer.h" |
| 15 #include "cc/heads_up_display_layer_impl.h" | 15 #include "cc/heads_up_display_layer_impl.h" |
| 16 #include "cc/layer.h" | 16 #include "cc/layer.h" |
| 17 #include "cc/layer_animation_controller.h" | 17 #include "cc/layer_animation_controller.h" |
| 18 #include "cc/layer_iterator.h" | 18 #include "cc/layer_iterator.h" |
| 19 #include "cc/layer_tree_host_client.h" | 19 #include "cc/layer_tree_host_client.h" |
| 20 #include "cc/layer_tree_host_common.h" | 20 #include "cc/layer_tree_host_common.h" |
| 21 #include "cc/layer_tree_host_impl.h" | 21 #include "cc/layer_tree_host_impl.h" |
| 22 #include "cc/layer_tree_impl.h" | 22 #include "cc/layer_tree_impl.h" |
| 23 #include "cc/math_util.h" | 23 #include "cc/math_util.h" |
| 24 #include "cc/occlusion_tracker.h" | 24 #include "cc/occlusion_tracker.h" |
| 25 #include "cc/overdraw_metrics.h" | 25 #include "cc/overdraw_metrics.h" |
| 26 #include "cc/picture_layer.h" | |
| 27 #include "cc/picture_pile_impl.h" | |
| 26 #include "cc/single_thread_proxy.h" | 28 #include "cc/single_thread_proxy.h" |
| 27 #include "cc/switches.h" | 29 #include "cc/switches.h" |
| 28 #include "cc/thread.h" | 30 #include "cc/thread.h" |
| 29 #include "cc/thread_proxy.h" | 31 #include "cc/thread_proxy.h" |
| 30 #include "cc/tree_synchronizer.h" | 32 #include "cc/tree_synchronizer.h" |
| 31 | 33 |
| 32 using namespace std; | 34 using namespace std; |
| 33 | 35 |
| 34 namespace { | 36 namespace { |
| 35 static int numLayerTreeInstances; | 37 static int numLayerTreeInstances; |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 893 layer->notifyAnimationStarted(events[eventIndex], wallClockTime. ToDoubleT()); | 895 layer->notifyAnimationStarted(events[eventIndex], wallClockTime. ToDoubleT()); |
| 894 else | 896 else |
| 895 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 897 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 896 } | 898 } |
| 897 } | 899 } |
| 898 | 900 |
| 899 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 901 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
| 900 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 902 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
| 901 } | 903 } |
| 902 | 904 |
| 905 Layer* LayerTreeHost::getNonCompositedContentRootLayer() const | |
| 906 { | |
| 907 // Non-composited content root is the first drawable layer we find | |
| 908 // in a breadth-first exploration from the root. | |
|
enne (OOO)
2013/01/02 19:35:22
Can you not just use an in-order traversal instead
Leandro Graciá Gil
2013/01/02 19:50:46
How is this in-order traversal defined given that
enne (OOO)
2013/01/02 20:16:57
Yeah, that's exactly what I was trying to say.
Leandro Graciá Gil
2013/01/03 20:32:10
Done.
| |
| 909 std::queue<Layer*> layers; | |
| 910 layers.push(m_rootLayer.get()); | |
| 911 | |
| 912 while (!layers.empty()) { | |
| 913 Layer* layer = layers.front(); | |
| 914 layers.pop(); | |
| 915 | |
| 916 if (!layer) | |
| 917 return NULL; | |
| 918 | |
| 919 if (layer->isDrawable() && layer->isPictureLayer()) | |
|
enne (OOO)
2013/01/02 19:35:22
This is only going to be true if impl-side paintin
Leandro Graciá Gil
2013/01/02 19:50:46
This is ok for our use case as we'll always use im
enne (OOO)
2013/01/02 20:16:57
I think the right answer is to just not expose thi
Leandro Graciá Gil
2013/01/03 20:32:10
Done.
| |
| 920 return layer; | |
| 921 | |
| 922 for (LayerList::const_iterator it = layer->children().begin(); | |
| 923 it != layer->children().end(); ++it) { | |
| 924 layers.push(it->get()); | |
| 925 } | |
| 926 } | |
| 927 | |
| 928 return NULL; | |
| 929 } | |
| 930 | |
| 931 scoped_refptr<PicturePileImpl> LayerTreeHost::capturePicturePile(const Layer* la yer) | |
| 932 { | |
| 933 if (!layer || !layer->isPictureLayer()) | |
| 934 return scoped_refptr<PicturePileImpl>(); | |
| 935 | |
| 936 return m_proxy->capturePicturePile(static_cast<const PictureLayer*>(layer)); | |
| 937 } | |
| 938 | |
| 903 } // namespace cc | 939 } // namespace cc |
| OLD | NEW |