summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host.cc2
-rw-r--r--cc/trees/layer_tree_host.h2
-rw-r--r--cc/trees/layer_tree_host_impl.cc16
-rw-r--r--cc/trees/layer_tree_host_unittest.cc10
-rw-r--r--cc/trees/layer_tree_host_unittest_occlusion.cc11
-rw-r--r--cc/trees/layer_tree_impl.cc1
-rw-r--r--cc/trees/occlusion_tracker.cc93
-rw-r--r--cc/trees/occlusion_tracker.h18
-rw-r--r--cc/trees/occlusion_tracker_perftest.cc6
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc163
-rw-r--r--cc/trees/quad_culler.cc4
-rw-r--r--cc/trees/quad_culler.h8
-rw-r--r--cc/trees/quad_culler_unittest.cc80
13 files changed, 191 insertions, 223 deletions
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 097ad5da..2a8248e 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -989,7 +989,7 @@ void LayerTreeHost::PaintLayerContents(
settings_.show_overdraw_in_tracing &&
base::debug::TraceLog::GetInstance() &&
base::debug::TraceLog::GetInstance()->IsEnabled();
- OcclusionTracker occlusion_tracker(
+ OcclusionTracker<Layer> occlusion_tracker(
root_layer_->render_surface()->content_rect(), record_metrics_for_frame);
occlusion_tracker.set_minimum_tracking_size(
settings_.minimum_occlusion_tracking_size);
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 1a2a65b..7dcf3e6 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -26,6 +26,7 @@
#include "cc/base/swap_promise_monitor.h"
#include "cc/debug/micro_benchmark.h"
#include "cc/debug/micro_benchmark_controller.h"
+#include "cc/debug/overdraw_metrics.h"
#include "cc/input/input_handler.h"
#include "cc/input/scrollbar.h"
#include "cc/input/top_controls_state.h"
@@ -36,7 +37,6 @@
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_settings.h"
-#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/proxy.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/rect.h"
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 50a6c41..a7f251b 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -54,6 +54,7 @@
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_impl.h"
+#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/quad_culler.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
@@ -560,10 +561,11 @@ static DrawMode GetDrawMode(OutputSurface* output_surface) {
}
}
-static void AppendQuadsForLayer(RenderPass* target_render_pass,
- LayerImpl* layer,
- const OcclusionTrackerImpl& occlusion_tracker,
- AppendQuadsData* append_quads_data) {
+static void AppendQuadsForLayer(
+ RenderPass* target_render_pass,
+ LayerImpl* layer,
+ const OcclusionTracker<LayerImpl>& occlusion_tracker,
+ AppendQuadsData* append_quads_data) {
bool for_surface = false;
QuadCuller quad_culler(&target_render_pass->quad_list,
&target_render_pass->shared_quad_state_list,
@@ -578,7 +580,7 @@ static void AppendQuadsForRenderSurfaceLayer(
RenderPass* target_render_pass,
LayerImpl* layer,
const RenderPass* contributing_render_pass,
- const OcclusionTrackerImpl& occlusion_tracker,
+ const OcclusionTracker<LayerImpl>& occlusion_tracker,
AppendQuadsData* append_quads_data) {
bool for_surface = true;
QuadCuller quad_culler(&target_render_pass->quad_list,
@@ -611,7 +613,7 @@ static void AppendQuadsToFillScreen(
RenderPass* target_render_pass,
LayerImpl* root_layer,
SkColor screen_background_color,
- const OcclusionTrackerImpl& occlusion_tracker) {
+ const OcclusionTracker<LayerImpl>& occlusion_tracker) {
if (!root_layer || !SkColorGetA(screen_background_color))
return;
@@ -747,7 +749,7 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
settings_.show_overdraw_in_tracing &&
base::debug::TraceLog::GetInstance() &&
base::debug::TraceLog::GetInstance()->IsEnabled();
- OcclusionTrackerImpl occlusion_tracker(
+ OcclusionTracker<LayerImpl> occlusion_tracker(
active_tree_->root_layer()->render_surface()->content_rect(),
record_metrics_for_frame);
occlusion_tracker.set_minimum_tracking_size(
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 8212993..f395398 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -40,7 +40,6 @@
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
-#include "cc/test/occlusion_tracker_test_common.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_impl.h"
@@ -1329,7 +1328,7 @@ class ContentLayerWithUpdateTracking : public ContentLayer {
void ResetPaintContentsCount() { paint_contents_count_ = 0; }
virtual bool Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE {
+ const OcclusionTracker<Layer>* occlusion) OVERRIDE {
bool updated = ContentLayer::Update(queue, occlusion);
paint_contents_count_++;
return updated;
@@ -2020,7 +2019,8 @@ class EvictionTestLayer : public Layer {
return make_scoped_refptr(new EvictionTestLayer());
}
- virtual bool Update(ResourceUpdateQueue*, const OcclusionTracker*) OVERRIDE;
+ virtual bool Update(ResourceUpdateQueue*,
+ const OcclusionTracker<Layer>*) OVERRIDE;
virtual bool DrawsContent() const OVERRIDE { return true; }
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
@@ -2081,7 +2081,7 @@ void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) {
}
bool EvictionTestLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker*) {
+ const OcclusionTracker<Layer>* occlusion) {
CreateTextureIfNeeded();
if (!texture_)
return false;
@@ -4667,7 +4667,7 @@ class LayerSetsNeedsFilterContext : public Layer {
}
virtual bool Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE {
+ const OcclusionTracker<Layer>* occlusion) OVERRIDE {
bool updated = Layer::Update(queue, occlusion);
if (needs_context_) {
layer_tree_host()->set_needs_filter_context();
diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc
index 491b42f1..352b5cf 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -8,7 +8,7 @@
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "cc/test/layer_tree_test.h"
-#include "cc/test/occlusion_tracker_test_common.h"
+#include "cc/test/test_occlusion_tracker.h"
namespace cc {
namespace {
@@ -19,15 +19,14 @@ class TestLayer : public Layer {
return make_scoped_refptr(new TestLayer());
}
- virtual bool Update(
- ResourceUpdateQueue* update_queue,
- const OcclusionTracker* occlusion) OVERRIDE {
+ virtual bool Update(ResourceUpdateQueue* update_queue,
+ const OcclusionTracker<Layer>* occlusion) OVERRIDE {
if (!occlusion)
return false;
// Gain access to internals of the OcclusionTracker.
- const TestOcclusionTracker* test_occlusion =
- static_cast<const TestOcclusionTracker*>(occlusion);
+ const TestOcclusionTracker<Layer>* test_occlusion =
+ static_cast<const TestOcclusionTracker<Layer>*>(occlusion);
occlusion_ = UnionRegions(
test_occlusion->occlusion_from_inside_target(),
test_occlusion->occlusion_from_outside_target());
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 8fe1f88..1142a6e 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -12,6 +12,7 @@
#include "cc/debug/traced_value.h"
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer.h"
+#include "cc/layers/layer_iterator.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/layers/scrollbar_layer_impl_base.h"
#include "cc/resources/ui_resource_request.h"
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc
index 11982a8..6d6f320 100644
--- a/cc/trees/occlusion_tracker.cc
+++ b/cc/trees/occlusion_tracker.cc
@@ -17,19 +17,20 @@
namespace cc {
-template <typename LayerType, typename RenderSurfaceType>
-OcclusionTrackerBase<LayerType, RenderSurfaceType>::OcclusionTrackerBase(
- const gfx::Rect& screen_space_clip_rect, bool record_metrics_for_frame)
+template <typename LayerType>
+OcclusionTracker<LayerType>::OcclusionTracker(
+ const gfx::Rect& screen_space_clip_rect,
+ bool record_metrics_for_frame)
: screen_space_clip_rect_(screen_space_clip_rect),
overdraw_metrics_(OverdrawMetrics::Create(record_metrics_for_frame)),
occluding_screen_space_rects_(NULL),
non_occluding_screen_space_rects_(NULL) {}
-template <typename LayerType, typename RenderSurfaceType>
-OcclusionTrackerBase<LayerType, RenderSurfaceType>::~OcclusionTrackerBase() {}
+template <typename LayerType>
+OcclusionTracker<LayerType>::~OcclusionTracker() {}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::EnterLayer(
+template <typename LayerType>
+void OcclusionTracker<LayerType>::EnterLayer(
const LayerIteratorPosition<LayerType>& layer_iterator) {
LayerType* render_target = layer_iterator.target_render_surface_layer;
@@ -39,8 +40,8 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::EnterLayer(
FinishedRenderTarget(render_target);
}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveLayer(
+template <typename LayerType>
+void OcclusionTracker<LayerType>::LeaveLayer(
const LayerIteratorPosition<LayerType>& layer_iterator) {
LayerType* render_target = layer_iterator.target_render_surface_layer;
@@ -145,20 +146,21 @@ static inline bool LayerIsHidden(const LayerType* layer) {
(layer->parent() && LayerIsHidden(layer->parent()));
}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::EnterRenderTarget(
+template <typename LayerType>
+void OcclusionTracker<LayerType>::EnterRenderTarget(
const LayerType* new_target) {
if (!stack_.empty() && stack_.back().target == new_target)
return;
const LayerType* old_target = NULL;
- const RenderSurfaceType* old_occlusion_immune_ancestor = NULL;
+ const typename LayerType::RenderSurfaceType* old_occlusion_immune_ancestor =
+ NULL;
if (!stack_.empty()) {
old_target = stack_.back().target;
old_occlusion_immune_ancestor =
old_target->render_surface()->nearest_occlusion_immune_ancestor();
}
- const RenderSurfaceType* new_occlusion_immune_ancestor =
+ const typename LayerType::RenderSurfaceType* new_occlusion_immune_ancestor =
new_target->render_surface()->nearest_occlusion_immune_ancestor();
stack_.push_back(StackObject(new_target));
@@ -198,26 +200,27 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::EnterRenderTarget(
inverse_new_target_screen_space_transform,
old_target->render_surface()->screen_space_transform());
stack_[last_index].occlusion_from_outside_target =
- TransformSurfaceOpaqueRegion<RenderSurfaceType>(
+ TransformSurfaceOpaqueRegion<typename LayerType::RenderSurfaceType>(
stack_[last_index - 1].occlusion_from_outside_target,
false,
gfx::Rect(),
old_target_to_new_target_transform);
stack_[last_index].occlusion_from_outside_target.Union(
- TransformSurfaceOpaqueRegion<RenderSurfaceType>(
+ TransformSurfaceOpaqueRegion<typename LayerType::RenderSurfaceType>(
stack_[last_index - 1].occlusion_from_inside_target,
false,
gfx::Rect(),
old_target_to_new_target_transform));
}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::FinishedRenderTarget(
+template <typename LayerType>
+void OcclusionTracker<LayerType>::FinishedRenderTarget(
const LayerType* finished_target) {
// Make sure we know about the target surface.
EnterRenderTarget(finished_target);
- RenderSurfaceType* surface = finished_target->render_surface();
+ typename LayerType::RenderSurfaceType* surface =
+ finished_target->render_surface();
// Readbacks always happen on render targets so we only need to check
// for readbacks here.
@@ -294,8 +297,8 @@ static void ReduceOcclusionBelowSurface(LayerType* contributing_layer,
}
}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveToRenderTarget(
+template <typename LayerType>
+void OcclusionTracker<LayerType>::LeaveToRenderTarget(
const LayerType* new_target) {
int last_index = stack_.size() - 1;
bool surface_will_be_at_top_after_pop =
@@ -306,17 +309,18 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveToRenderTarget(
// merged out as well but needs to be transformed to the new target.
const LayerType* old_target = stack_[last_index].target;
- const RenderSurfaceType* old_surface = old_target->render_surface();
+ const typename LayerType::RenderSurfaceType* old_surface =
+ old_target->render_surface();
Region old_occlusion_from_inside_target_in_new_target =
- TransformSurfaceOpaqueRegion<RenderSurfaceType>(
+ TransformSurfaceOpaqueRegion<typename LayerType::RenderSurfaceType>(
stack_[last_index].occlusion_from_inside_target,
old_surface->is_clipped(),
old_surface->clip_rect(),
old_surface->draw_transform());
if (old_target->has_replica() && !old_target->replica_has_mask()) {
old_occlusion_from_inside_target_in_new_target.Union(
- TransformSurfaceOpaqueRegion<RenderSurfaceType>(
+ TransformSurfaceOpaqueRegion<typename LayerType::RenderSurfaceType>(
stack_[last_index].occlusion_from_inside_target,
old_surface->is_clipped(),
old_surface->clip_rect(),
@@ -324,7 +328,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveToRenderTarget(
}
Region old_occlusion_from_outside_target_in_new_target =
- TransformSurfaceOpaqueRegion<RenderSurfaceType>(
+ TransformSurfaceOpaqueRegion<typename LayerType::RenderSurfaceType>(
stack_[last_index].occlusion_from_outside_target,
false,
gfx::Rect(),
@@ -393,9 +397,9 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveToRenderTarget(
&stack_.back().occlusion_from_outside_target);
}
-template <typename LayerType, typename RenderSurfaceType>
-void OcclusionTrackerBase<LayerType, RenderSurfaceType>::
- MarkOccludedBehindLayer(const LayerType* layer) {
+template <typename LayerType>
+void OcclusionTracker<LayerType>::MarkOccludedBehindLayer(
+ const LayerType* layer) {
DCHECK(!stack_.empty());
DCHECK_EQ(layer->render_target(), stack_.back().target);
if (stack_.empty())
@@ -496,8 +500,8 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::
}
}
-template <typename LayerType, typename RenderSurfaceType>
-bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::Occluded(
+template <typename LayerType>
+bool OcclusionTracker<LayerType>::Occluded(
const LayerType* render_target,
const gfx::Rect& content_rect,
const gfx::Transform& draw_transform,
@@ -544,13 +548,12 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::Occluded(
return unoccluded_rect_in_target_surface.IsEmpty();
}
-template <typename LayerType, typename RenderSurfaceType>
-gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::
- UnoccludedContentRect(
- const LayerType* render_target,
- const gfx::Rect& content_rect,
- const gfx::Transform& draw_transform,
- bool impl_draw_transform_is_unknown) const {
+template <typename LayerType>
+gfx::Rect OcclusionTracker<LayerType>::UnoccludedContentRect(
+ const LayerType* render_target,
+ const gfx::Rect& content_rect,
+ const gfx::Transform& draw_transform,
+ bool impl_draw_transform_is_unknown) const {
DCHECK(!stack_.empty());
if (stack_.empty())
return content_rect;
@@ -594,12 +597,11 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::
return unoccluded_rect;
}
-template <typename LayerType, typename RenderSurfaceType>
-gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::
- UnoccludedContributingSurfaceContentRect(
- const LayerType* layer,
- bool for_replica,
- const gfx::Rect& content_rect) const {
+template <typename LayerType>
+gfx::Rect OcclusionTracker<LayerType>::UnoccludedContributingSurfaceContentRect(
+ const LayerType* layer,
+ bool for_replica,
+ const gfx::Rect& content_rect) const {
DCHECK(!stack_.empty());
// The layer is a contributing render_target so it should have a surface.
DCHECK(layer->render_surface());
@@ -614,7 +616,8 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::
if (content_rect.IsEmpty())
return content_rect;
- const RenderSurfaceType* surface = layer->render_surface();
+ const typename LayerType::RenderSurfaceType* surface =
+ layer->render_surface();
const LayerType* contributing_surface_render_target =
layer->parent()->render_target();
@@ -666,7 +669,7 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::
}
// Instantiate (and export) templates here for the linker.
-template class OcclusionTrackerBase<Layer, RenderSurface>;
-template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
+template class OcclusionTracker<Layer>;
+template class OcclusionTracker<LayerImpl>;
} // namespace cc
diff --git a/cc/trees/occlusion_tracker.h b/cc/trees/occlusion_tracker.h
index 2fe54d0..39cd026 100644
--- a/cc/trees/occlusion_tracker.h
+++ b/cc/trees/occlusion_tracker.h
@@ -29,12 +29,12 @@ class RenderSurface;
// be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally,
// once finished with the layer, occlusion behind the layer should be marked by
// calling MarkOccludedBehindLayer().
-template <typename LayerType, typename RenderSurfaceType>
-class CC_EXPORT OcclusionTrackerBase {
+template <typename LayerType>
+class CC_EXPORT OcclusionTracker {
public:
- OcclusionTrackerBase(const gfx::Rect& screen_space_clip_rect,
- bool record_metrics_for_frame);
- ~OcclusionTrackerBase();
+ OcclusionTracker(const gfx::Rect& screen_space_clip_rect,
+ bool record_metrics_for_frame);
+ ~OcclusionTracker();
// Called at the beginning of each step in the LayerIterator's front-to-back
// traversal.
@@ -149,14 +149,12 @@ class CC_EXPORT OcclusionTrackerBase {
std::vector<gfx::Rect>* occluding_screen_space_rects_;
std::vector<gfx::Rect>* non_occluding_screen_space_rects_;
- DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase);
+ DISALLOW_COPY_AND_ASSIGN(OcclusionTracker);
};
-typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker;
-typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl;
#if !defined(COMPILER_MSVC)
-extern template class OcclusionTrackerBase<Layer, RenderSurface>;
-extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
+extern template class OcclusionTracker<Layer>;
+extern template class OcclusionTracker<LayerImpl>;
#endif
} // namespace cc
diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc
index f4a2faf..344e48c 100644
--- a/cc/trees/occlusion_tracker_perftest.cc
+++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -71,8 +71,7 @@ TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) {
SetTestName("unoccluded_content_rect_fully_occluded");
gfx::Rect viewport_rect(768, 1038);
- OcclusionTrackerBase<LayerImpl, LayerImpl::RenderSurfaceType> tracker(
- viewport_rect, false);
+ OcclusionTracker<LayerImpl> tracker(viewport_rect, false);
CreateHost();
host_impl_->SetViewportSize(viewport_rect.size());
@@ -140,8 +139,7 @@ TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) {
SetTestName("unoccluded_content_rect_10_opaque_layers");
gfx::Rect viewport_rect(768, 1038);
- OcclusionTrackerBase<LayerImpl, LayerImpl::RenderSurfaceType> tracker(
- viewport_rect, false);
+ OcclusionTracker<LayerImpl> tracker(viewport_rect, false);
CreateHost();
host_impl_->SetViewportSize(viewport_rect.size());
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 3e4ff5b..b61ed70 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -18,7 +18,7 @@
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
-#include "cc/test/occlusion_tracker_test_common.h"
+#include "cc/test/test_occlusion_tracker.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -80,18 +80,15 @@ static inline bool LayerImplDrawTransformIsUnknown(const LayerImpl* layer) {
return false;
}
-template <typename LayerType, typename RenderSurfaceType>
-class TestOcclusionTrackerWithClip
- : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> {
+template <typename LayerType>
+class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> {
public:
TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect,
bool record_metrics_for_frame)
- : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(
- viewport_rect,
- record_metrics_for_frame) {}
+ : TestOcclusionTracker<LayerType>(viewport_rect,
+ record_metrics_for_frame) {}
explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect)
- : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewport_rect,
- false) {}
+ : TestOcclusionTracker<LayerType>(viewport_rect, false) {}
bool OccludedLayer(const LayerType* layer,
const gfx::Rect& content_rect) const {
@@ -123,7 +120,7 @@ struct OcclusionTrackerTestMainThreadTypes {
typedef scoped_refptr<Layer> LayerPtrType;
typedef scoped_refptr<ContentLayerType> ContentLayerPtrType;
typedef LayerIterator<Layer> TestLayerIterator;
- typedef OcclusionTracker OcclusionTrackerType;
+ typedef OcclusionTracker<Layer> OcclusionTrackerType;
static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); }
static ContentLayerPtrType CreateContentLayer(HostType* host) {
@@ -153,7 +150,7 @@ struct OcclusionTrackerTestImplThreadTypes {
typedef scoped_ptr<LayerImpl> LayerPtrType;
typedef scoped_ptr<ContentLayerType> ContentLayerPtrType;
typedef LayerIterator<LayerImpl> TestLayerIterator;
- typedef OcclusionTrackerImpl OcclusionTrackerType;
+ typedef OcclusionTracker<LayerImpl> OcclusionTrackerType;
static LayerPtrType CreateLayer(HostType* host) {
return LayerImpl::Create(host, next_layer_impl_id++);
@@ -545,8 +542,7 @@ class OcclusionTrackerTestIdentityTransforms
parent->SetMasksToBounds(true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000), false);
this->VisitLayer(layer, &occlusion);
@@ -612,8 +608,7 @@ class OcclusionTrackerTestQuadsMismatchLayer
layer1, layer_transform, gfx::PointF(), gfx::Size(50, 50), true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer2, &occlusion);
@@ -679,8 +674,7 @@ class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> {
parent->SetMasksToBounds(true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer, &occlusion);
@@ -750,8 +744,7 @@ class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> {
parent->SetMasksToBounds(true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer, &occlusion);
@@ -822,8 +815,7 @@ class OcclusionTrackerTestChildInRotatedChild
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer, &occlusion);
@@ -929,8 +921,7 @@ class OcclusionTrackerTestScaledRenderSurface
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(occluder, &occlusion);
@@ -994,8 +985,7 @@ class OcclusionTrackerTestVisitTargetTwoTimes
true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(child2, &occlusion);
@@ -1161,8 +1151,7 @@ class OcclusionTrackerTestSurfaceRotatedOffAxis
child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect(
@@ -1231,8 +1220,7 @@ class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren
true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer2, &occlusion);
@@ -1351,8 +1339,7 @@ class OcclusionTrackerTestOverlappingSurfaceSiblings
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer2, &occlusion);
@@ -1472,8 +1459,7 @@ class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(layer2, &occlusion);
@@ -1596,8 +1582,7 @@ class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> {
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// Opacity layer won't contribute to occlusion.
@@ -1668,8 +1653,7 @@ class OcclusionTrackerTestReplicaDoesOcclude
surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size());
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface, &occlusion);
@@ -1710,8 +1694,7 @@ class OcclusionTrackerTestReplicaWithClipping
surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size());
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface, &occlusion);
@@ -1751,8 +1734,7 @@ class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> {
this->CreateMaskLayer(replica, gfx::Size(10, 10));
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface, &occlusion);
@@ -1789,8 +1771,7 @@ class OcclusionTrackerTestOpaqueContentsRegionEmpty
false);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->EnterLayer(layer, &occlusion);
@@ -1826,8 +1807,7 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty
false);
this->CalcDrawEtc(parent);
{
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
layer->SetOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
@@ -1846,8 +1826,7 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty
occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
}
{
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
layer->SetOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
@@ -1866,8 +1845,7 @@ class OcclusionTrackerTestOpaqueContentsRegionNonEmpty
occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
}
{
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
layer->SetOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
@@ -1911,8 +1889,7 @@ class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> {
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->EnterLayer(layer, &occlusion);
@@ -1962,8 +1939,7 @@ class OcclusionTrackerTestUnsorted3dLayers
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(child2, &occlusion);
EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty());
@@ -2009,8 +1985,7 @@ class OcclusionTrackerTestPerspectiveTransform
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->EnterLayer(layer, &occlusion);
@@ -2054,8 +2029,7 @@ class OcclusionTrackerTestPerspectiveTransformBehindCamera
layer->SetIs3dSorted(true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->EnterLayer(layer, &occlusion);
@@ -2098,8 +2072,7 @@ class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude
layer->SetIs3dSorted(true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// The |layer| is entirely behind the camera and should not occlude.
@@ -2140,8 +2113,7 @@ class OcclusionTrackerTestLargePixelsOccludeInsideClipRect
layer->SetIs3dSorted(true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// This is very close to the camera, so pixels in its visible_content_rect()
@@ -2225,8 +2197,7 @@ class OcclusionTrackerTestAnimationOpacity1OnMainThread
EXPECT_FALSE(surface->draw_opacity_is_animating());
EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating());
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(topmost, &occlusion);
@@ -2346,8 +2317,7 @@ class OcclusionTrackerTestAnimationOpacity0OnMainThread
EXPECT_FALSE(surface->draw_opacity_is_animating());
EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating());
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(topmost, &occlusion);
@@ -2468,8 +2438,7 @@ class OcclusionTrackerTestAnimationTranslateOnMainThread
EXPECT_TRUE(surface_child->draw_transform_is_animating());
EXPECT_TRUE(surface_child->screen_space_transform_is_animating());
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface2, &occlusion);
@@ -2590,8 +2559,7 @@ class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
surface2->SetOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface2, &occlusion);
@@ -2639,8 +2607,7 @@ class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping
surface->SetOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface, &occlusion);
@@ -2682,8 +2649,7 @@ class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> {
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the replica, but not the surface itself.
@@ -2740,8 +2706,7 @@ class OcclusionTrackerTestSurfaceWithReplicaUnoccluded
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the surface, but not the entire surface's replica.
@@ -2804,8 +2769,7 @@ class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// These occlude the surface and replica differently, so we can test each
@@ -2870,8 +2834,7 @@ class OcclusionTrackerTestSurfaceChildOfSurface
parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(-100, -100, 1000, 1000));
// |topmost| occludes everything partially so we know occlusion is happening
@@ -2948,8 +2911,7 @@ class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport
this->CalcDrawEtc(parent);
{
// Make a viewport rect that is larger than the root layer.
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(surface, &occlusion);
@@ -2966,8 +2928,7 @@ class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport
this->ResetLayerIterator();
{
// Make a viewport rect that is smaller than the root layer.
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 100, 100));
this->VisitLayer(surface, &occlusion);
@@ -3016,8 +2977,7 @@ class OcclusionTrackerTestSurfaceChildOfClippingSurface
parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes everything partially so we know occlusion is happening
@@ -3120,8 +3080,7 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// These layers occlude pixels directly beside the filtered_surface. Because
@@ -3264,8 +3223,7 @@ class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(occluding_layer_above, &occlusion);
@@ -3345,8 +3303,7 @@ class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
// The surface has a background blur, so it blurs non-opaque pixels below
@@ -3413,8 +3370,7 @@ class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(occluding_layer, &occlusion);
@@ -3515,8 +3471,7 @@ class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(beside_replica_layer, &occlusion);
@@ -3589,8 +3544,7 @@ class OcclusionTrackerTestMinimumTrackingSize
true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
occlusion.set_minimum_tracking_size(tracking_size);
@@ -3637,8 +3591,7 @@ class OcclusionTrackerTestScaledLayerIsClipped
scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(scaled, &occlusion);
@@ -3677,8 +3630,7 @@ class OcclusionTrackerTestScaledLayerInSurfaceIsClipped
scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true);
this->CalcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(scaled, &occlusion);
@@ -3718,8 +3670,7 @@ class OcclusionTrackerTestCopyRequestDoesOcclude
true);
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(copy_child, &occlusion);
@@ -3767,8 +3718,7 @@ class OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000));
this->VisitLayer(copy_child, &occlusion);
@@ -3807,8 +3757,7 @@ class OcclusionTrackerTestEmptyEventLayerDoesNotOcclude
this->CalcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType,
- typename Types::RenderSurfaceType> occlusion(
+ TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
gfx::Rect(0, 0, 1000, 1000), false);
this->VisitLayer(empty_layer, &occlusion);
diff --git a/cc/trees/quad_culler.cc b/cc/trees/quad_culler.cc
index 1b6404c..9ff2dcc 100644
--- a/cc/trees/quad_culler.cc
+++ b/cc/trees/quad_culler.cc
@@ -19,7 +19,7 @@ namespace cc {
QuadCuller::QuadCuller(QuadList* quad_list,
SharedQuadStateList* shared_quad_state_list,
const LayerImpl* layer,
- const OcclusionTrackerImpl& occlusion_tracker,
+ const OcclusionTracker<LayerImpl>& occlusion_tracker,
bool show_culling_with_debug_border_quads,
bool for_surface)
: quad_list_(quad_list),
@@ -44,7 +44,7 @@ static inline bool AppendQuadInternal(
scoped_ptr<DrawQuad> draw_quad,
const gfx::Rect& culled_rect,
QuadList* quad_list,
- const OcclusionTrackerImpl& occlusion_tracker,
+ const OcclusionTracker<LayerImpl>& occlusion_tracker,
const LayerImpl* layer,
bool create_debug_border_quads) {
bool keep_quad = !culled_rect.IsEmpty();
diff --git a/cc/trees/quad_culler.h b/cc/trees/quad_culler.h
index be0095f..3d71543 100644
--- a/cc/trees/quad_culler.h
+++ b/cc/trees/quad_culler.h
@@ -12,15 +12,15 @@
namespace cc {
class LayerImpl;
class RenderSurfaceImpl;
-template <typename LayerType, typename SurfaceType> class OcclusionTrackerBase;
+template <typename LayerType>
+class OcclusionTracker;
class CC_EXPORT QuadCuller : public QuadSink {
public:
QuadCuller(QuadList* quad_list,
SharedQuadStateList* shared_quad_state_list,
const LayerImpl* layer,
- const OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>&
- occlusion_tracker,
+ const OcclusionTracker<LayerImpl>& occlusion_tracker,
bool show_culling_with_debug_border_quads,
bool for_surface);
virtual ~QuadCuller() {}
@@ -35,7 +35,7 @@ class CC_EXPORT QuadCuller : public QuadSink {
QuadList* quad_list_;
SharedQuadStateList* shared_quad_state_list_;
const LayerImpl* layer_;
- const OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>& occlusion_tracker_;
+ const OcclusionTracker<LayerImpl>& occlusion_tracker_;
SharedQuadState* current_shared_quad_state_;
bool show_culling_with_debug_border_quads_;
diff --git a/cc/trees/quad_culler_unittest.cc b/cc/trees/quad_culler_unittest.cc
index ee97319..27e3de5 100644
--- a/cc/trees/quad_culler_unittest.cc
+++ b/cc/trees/quad_culler_unittest.cc
@@ -17,7 +17,7 @@
#include "cc/resources/layer_tiling_data.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
-#include "cc/test/occlusion_tracker_test_common.h"
+#include "cc/test/test_occlusion_tracker.h"
#include "cc/trees/occlusion_tracker.h"
#include "cc/trees/single_thread_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -27,18 +27,6 @@
namespace cc {
namespace {
-class TestOcclusionTrackerImpl
- : public TestOcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> {
- public:
- TestOcclusionTrackerImpl(const gfx::Rect& scissor_rect_in_screen,
- bool record_metrics_for_frame = true)
- : TestOcclusionTrackerBase(scissor_rect_in_screen,
- record_metrics_for_frame) {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestOcclusionTrackerImpl);
-};
-
typedef LayerIterator<LayerImpl> LayerIteratorType;
class QuadCullerTest : public testing::Test {
@@ -104,7 +92,7 @@ class QuadCullerTest : public testing::Test {
SharedQuadStateList* shared_state_list,
TiledLayerImpl* layer,
LayerIteratorType* it,
- OcclusionTrackerImpl* occlusion_tracker) {
+ OcclusionTracker<LayerImpl>* occlusion_tracker) {
occlusion_tracker->EnterLayer(*it);
QuadCuller quad_culler(
quad_list, shared_state_list, layer, *occlusion_tracker, false, false);
@@ -150,7 +138,9 @@ TEST_F(QuadCullerTest, NoCulling) {
false,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -190,7 +180,9 @@ TEST_F(QuadCullerTest, CullChildLinesUpTopLeft) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -230,7 +222,9 @@ TEST_F(QuadCullerTest, CullWhenChildOpacityNotOne) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -270,7 +264,9 @@ TEST_F(QuadCullerTest, CullWhenChildOpaqueFlagFalse) {
false,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -311,7 +307,9 @@ TEST_F(QuadCullerTest, CullCenterTileOnly) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -377,7 +375,9 @@ TEST_F(QuadCullerTest, CullCenterTileNonIntegralSize1) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -428,7 +428,9 @@ TEST_F(QuadCullerTest, CullCenterTileNonIntegralSize2) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -469,7 +471,9 @@ TEST_F(QuadCullerTest, CullChildLinesUpBottomRight) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -514,7 +518,9 @@ TEST_F(QuadCullerTest, CullSubRegion) {
false,
child_opaque_rect,
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -560,7 +566,9 @@ TEST_F(QuadCullerTest, CullSubRegion2) {
false,
child_opaque_rect,
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -606,7 +614,9 @@ TEST_F(QuadCullerTest, CullSubRegionCheckOvercull) {
false,
child_opaque_rect,
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -650,7 +660,9 @@ TEST_F(QuadCullerTest, NonAxisAlignedQuadsDontOcclude) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -699,7 +711,9 @@ TEST_F(QuadCullerTest, NonAxisAlignedQuadsSafelyCulled) {
true,
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -739,8 +753,8 @@ TEST_F(QuadCullerTest, WithoutMetrics) {
gfx::Rect(),
render_surface_layer_list);
bool record_metrics = false;
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000),
- record_metrics);
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(
+ gfx::Rect(-100, -100, 1000, 1000), record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(&quad_list,
@@ -773,7 +787,9 @@ TEST_F(QuadCullerTest, PartialCullingNotDestroyed) {
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(gfx::Rect(1000, 1000),
+ record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
QuadCuller culler(&quad_list,
@@ -847,7 +863,9 @@ TEST_F(QuadCullerTest, PartialCullingWithOcclusionNotDestroyed) {
gfx::Rect(),
render_surface_layer_list);
- TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(1000, 1000));
+ bool record_metrics = true;
+ TestOcclusionTracker<LayerImpl> occlusion_tracker(gfx::Rect(1000, 1000),
+ record_metrics);
LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
QuadCuller culler(&quad_list,