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

Side by Side Diff: cc/delegated_renderer_layer_impl_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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
« no previous file with comments | « cc/damage_tracker_unittest.cc ('k') | cc/font_atlas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/delegated_renderer_layer_impl.h" 7 #include "cc/delegated_renderer_layer_impl.h"
8 8
9 #include "cc/append_quads_data.h" 9 #include "cc/append_quads_data.h"
10 #include "cc/layer_tree_host_impl.h" 10 #include "cc/layer_tree_host_impl.h"
11 #include "cc/quad_sink.h" 11 #include "cc/quad_sink.h"
12 #include "cc/render_pass_draw_quad.h" 12 #include "cc/render_pass_draw_quad.h"
13 #include "cc/scoped_ptr_vector.h" 13 #include "cc/scoped_ptr_vector.h"
14 #include "cc/single_thread_proxy.h" 14 #include "cc/single_thread_proxy.h"
15 #include "cc/solid_color_draw_quad.h" 15 #include "cc/solid_color_draw_quad.h"
16 #include "cc/solid_color_layer_impl.h" 16 #include "cc/solid_color_layer_impl.h"
17 #include "cc/test/fake_proxy.h"
17 #include "cc/test/fake_web_compositor_output_surface.h" 18 #include "cc/test/fake_web_compositor_output_surface.h"
18 #include "cc/test/fake_web_graphics_context_3d.h" 19 #include "cc/test/fake_web_graphics_context_3d.h"
19 #include "cc/test/geometry_test_utils.h" 20 #include "cc/test/geometry_test_utils.h"
20 #include "cc/test/mock_quad_culler.h" 21 #include "cc/test/mock_quad_culler.h"
21 #include "cc/test/render_pass_test_common.h" 22 #include "cc/test/render_pass_test_common.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include <public/WebTransformationMatrix.h> 24 #include <public/WebTransformationMatrix.h>
24 25
25 using WebKit::FakeWebCompositorOutputSurface; 26 using WebKit::FakeWebCompositorOutputSurface;
26 using WebKit::FakeWebGraphicsContext3D; 27 using WebKit::FakeWebGraphicsContext3D;
27 using WebKit::WebTransformationMatrix; 28 using WebKit::WebTransformationMatrix;
28 29
29 using namespace cc; 30 using namespace cc;
30 using namespace WebKitTests; 31 using namespace WebKitTests;
31 32
32 namespace { 33 namespace {
33 34
34 class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHos tImplClient { 35 class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHos tImplClient {
35 public: 36 public:
36 DelegatedRendererLayerImplTest() 37 DelegatedRendererLayerImplTest()
38 : m_proxy(scoped_ptr<Thread>(NULL))
39 , m_alwaysImplThreadAndMainThreadBlocked(&m_proxy)
37 { 40 {
38 LayerTreeSettings settings; 41 LayerTreeSettings settings;
39 settings.minimumOcclusionTrackingSize = gfx::Size(); 42 settings.minimumOcclusionTrackingSize = gfx::Size();
40 43
41 m_hostImpl = LayerTreeHostImpl::create(settings, this); 44 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
42 m_hostImpl->initializeRenderer(createContext()); 45 m_hostImpl->initializeRenderer(createContext());
43 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 46 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
44 } 47 }
45 48
46 // LayerTreeHostImplClient implementation. 49 // LayerTreeHostImplClient implementation.
47 virtual void didLoseContextOnImplThread() OVERRIDE { } 50 virtual void didLoseContextOnImplThread() OVERRIDE { }
48 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 51 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
49 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { } 52 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { }
50 virtual void onCanDrawStateChanged(bool) OVERRIDE { } 53 virtual void onCanDrawStateChanged(bool) OVERRIDE { }
51 virtual void setNeedsRedrawOnImplThread() OVERRIDE { } 54 virtual void setNeedsRedrawOnImplThread() OVERRIDE { }
52 virtual void setNeedsCommitOnImplThread() OVERRIDE { } 55 virtual void setNeedsCommitOnImplThread() OVERRIDE { }
53 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { } 56 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { }
54 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return true; } 57 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return true; }
55 virtual void sendManagedMemoryStats() OVERRIDE { } 58 virtual void sendManagedMemoryStats() OVERRIDE { }
56 59
57 protected: 60 protected:
58 scoped_ptr<GraphicsContext> createContext() 61 scoped_ptr<GraphicsContext> createContext()
59 { 62 {
60 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); 63 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
61 } 64 }
62 65
63 DebugScopedSetImplThread m_alwaysImplThread; 66 FakeProxy m_proxy;
64 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 67 DebugScopedSetImplThreadAndMainThreadBlocked m_alwaysImplThreadAndMainThread Blocked;
65
66 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 68 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
67 }; 69 };
68 70
69 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend erPass::Id id, gfx::Rect outputRect, WebTransformationMatrix rootTransform) 71 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend erPass::Id id, gfx::Rect outputRect, WebTransformationMatrix rootTransform)
70 { 72 {
71 scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootT ransform)); 73 scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootT ransform));
72 TestRenderPass* saved = pass.get(); 74 TestRenderPass* saved = pass.get();
73 passList.append(pass.PassAs<RenderPass>()); 75 passList.append(pass.PassAs<RenderPass>());
74 return saved; 76 return saved;
75 } 77 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState()); 448 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState());
447 449
448 // The state should be transformed only once. 450 // The state should be transformed only once.
449 EXPECT_RECT_EQ(gfx::Rect(30, 30, 50, 50), sharedState->clippedRectInTarget); 451 EXPECT_RECT_EQ(gfx::Rect(30, 30, 50, 50), sharedState->clippedRectInTarget);
450 WebTransformationMatrix expected; 452 WebTransformationMatrix expected;
451 expected.translate(30, 30); 453 expected.translate(30, 30);
452 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform); 454 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform);
453 } 455 }
454 456
455 } // annonymous namespace 457 } // annonymous namespace
OLDNEW
« no previous file with comments | « cc/damage_tracker_unittest.cc ('k') | cc/font_atlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698