Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: cc/occlusion_tracker_unittest.cc

Issue 11519018: [cc] Make LayerImpls point at LayerTreeImpl instead of LTHI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/occlusion_tracker.h" 5 #include "cc/occlusion_tracker.h"
6 6
7 #include <public/WebFilterOperation.h> 7 #include <public/WebFilterOperation.h>
8 #include <public/WebFilterOperations.h> 8 #include <public/WebFilterOperations.h>
9 9
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual ~TestContentLayer() 54 virtual ~TestContentLayer()
55 { 55 {
56 } 56 }
57 57
58 bool m_overrideOpaqueContentsRect; 58 bool m_overrideOpaqueContentsRect;
59 gfx::Rect m_opaqueContentsRect; 59 gfx::Rect m_opaqueContentsRect;
60 }; 60 };
61 61
62 class TestContentLayerImpl : public LayerImpl { 62 class TestContentLayerImpl : public LayerImpl {
63 public: 63 public:
64 TestContentLayerImpl(LayerTreeHostImpl* hostImpl, int id) 64 TestContentLayerImpl(LayerTreeImpl* treeImpl, int id)
65 : LayerImpl(hostImpl, id) 65 : LayerImpl(treeImpl, id)
66 , m_overrideOpaqueContentsRect(false) 66 , m_overrideOpaqueContentsRect(false)
67 { 67 {
68 setDrawsContent(true); 68 setDrawsContent(true);
69 } 69 }
70 70
71 virtual Region visibleContentOpaqueRegion() const OVERRIDE 71 virtual Region visibleContentOpaqueRegion() const OVERRIDE
72 { 72 {
73 if (m_overrideOpaqueContentsRect) 73 if (m_overrideOpaqueContentsRect)
74 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect( )); 74 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect( ));
75 return LayerImpl::visibleContentOpaqueRegion(); 75 return LayerImpl::visibleContentOpaqueRegion();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 static void destroyLayer(LayerPtrType& layer) 152 static void destroyLayer(LayerPtrType& layer)
153 { 153 {
154 layer = NULL; 154 layer = NULL;
155 } 155 }
156 }; 156 };
157 157
158 struct OcclusionTrackerTestImplThreadTypes { 158 struct OcclusionTrackerTestImplThreadTypes {
159 typedef LayerImpl LayerType; 159 typedef LayerImpl LayerType;
160 typedef LayerTreeHostImpl HostType; 160 typedef LayerTreeImpl HostType;
161 typedef RenderSurfaceImpl RenderSurfaceType; 161 typedef RenderSurfaceImpl RenderSurfaceType;
162 typedef TestContentLayerImpl ContentLayerType; 162 typedef TestContentLayerImpl ContentLayerType;
163 typedef scoped_ptr<LayerImpl> LayerPtrType; 163 typedef scoped_ptr<LayerImpl> LayerPtrType;
164 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; 164 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType;
165 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> TestLayerIterator; 165 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> TestLayerIterator;
166 typedef OcclusionTrackerImpl OcclusionTrackerType; 166 typedef OcclusionTrackerImpl OcclusionTrackerType;
167 167
168 static LayerPtrType createLayer(HostType* host) { return LayerImpl::create(h ost, nextLayerImplId++); } 168 static LayerPtrType createLayer(HostType* host) { return LayerImpl::create(h ost, nextLayerImplId++); }
169 static ContentLayerPtrType createContentLayer(HostType* host) { return make_ scoped_ptr(new ContentLayerType(host, nextLayerImplId++)); } 169 static ContentLayerPtrType createContentLayer(HostType* host) { return make_ scoped_ptr(new ContentLayerType(host, nextLayerImplId++)); }
170 static int nextLayerImplId; 170 static int nextLayerImplId;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 std::vector<scoped_refptr<Layer> > m_maskLayers; 421 std::vector<scoped_refptr<Layer> > m_maskLayers;
422 }; 422 };
423 423
424 template<> 424 template<>
425 LayerTreeHost* OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::getHos t() 425 LayerTreeHost* OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::getHos t()
426 { 426 {
427 return 0; 427 return 0;
428 } 428 }
429 429
430 template<> 430 template<>
431 LayerTreeHostImpl* OcclusionTrackerTest<OcclusionTrackerTestImplThreadTypes>::ge tHost() 431 LayerTreeImpl* OcclusionTrackerTest<OcclusionTrackerTestImplThreadTypes>::getHos t()
432 { 432 {
433 return &m_hostImpl; 433 return m_hostImpl.activeTree();
434 } 434 }
435 435
436 #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ 436 #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
437 class ClassName##MainThreadOpaqueLayers : public ClassName<OcclusionTrackerT estMainThreadTypes> { \ 437 class ClassName##MainThreadOpaqueLayers : public ClassName<OcclusionTrackerT estMainThreadTypes> { \
438 public: \ 438 public: \
439 ClassName##MainThreadOpaqueLayers() : ClassName<OcclusionTrackerTestMain ThreadTypes>(true) { } \ 439 ClassName##MainThreadOpaqueLayers() : ClassName<OcclusionTrackerTestMain ThreadTypes>(true) { } \
440 }; \ 440 }; \
441 TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); } 441 TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); }
442 #define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ 442 #define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \
443 class ClassName##MainThreadOpaquePaints : public ClassName<OcclusionTrackerT estMainThreadTypes> { \ 443 class ClassName##MainThreadOpaquePaints : public ClassName<OcclusionTrackerT estMainThreadTypes> { \
(...skipping 2654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 3098
3099 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString()); 3099 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString());
3100 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString()); 3100 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString());
3101 } 3101 }
3102 }; 3102 };
3103 3103
3104 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); 3104 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize);
3105 3105
3106 } // namespace 3106 } // namespace
3107 } // namespace cc 3107 } // namespace cc
OLDNEW
« cc/layer.h ('K') | « cc/nine_patch_layer_impl_unittest.cc ('k') | cc/picture_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698