| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 WebKit::WGC3Duint plane)); | 2383 WebKit::WGC3Duint plane)); |
| 2384 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, | 2384 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, |
| 2385 WebKit::WGC3Dsizei count, | 2385 WebKit::WGC3Dsizei count, |
| 2386 WebKit::WGC3Denum type, | 2386 WebKit::WGC3Denum type, |
| 2387 WebKit::WGC3Dintptr offset)); | 2387 WebKit::WGC3Dintptr offset)); |
| 2388 }; | 2388 }; |
| 2389 | 2389 |
| 2390 | 2390 |
| 2391 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { | 2391 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { |
| 2392 protected: | 2392 protected: |
| 2393 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 2393 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 2394 OVERRIDE { |
| 2394 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> context( | 2395 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> context( |
| 2395 new MockIOSurfaceWebGraphicsContext3D); | 2396 new MockIOSurfaceWebGraphicsContext3D); |
| 2396 mock_context_ = context.get(); | 2397 mock_context_ = context.get(); |
| 2397 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( | 2398 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( |
| 2398 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 2399 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 2399 return output_surface.Pass(); | 2400 return output_surface.Pass(); |
| 2400 } | 2401 } |
| 2401 | 2402 |
| 2402 virtual void SetupTree() OVERRIDE { | 2403 virtual void SetupTree() OVERRIDE { |
| 2403 LayerTreeHostTest::SetupTree(); | 2404 LayerTreeHostTest::SetupTree(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap().Pass(); | 2569 scoped_ptr<SkBitmap> bitmap = result->TakeBitmap().Pass(); |
| 2569 EXPECT_EQ(result->size().ToString(), | 2570 EXPECT_EQ(result->size().ToString(), |
| 2570 gfx::Size(bitmap->width(), bitmap->height()).ToString()); | 2571 gfx::Size(bitmap->width(), bitmap->height()).ToString()); |
| 2571 callbacks_.push_back(result->size()); | 2572 callbacks_.push_back(result->size()); |
| 2572 } | 2573 } |
| 2573 | 2574 |
| 2574 virtual void AfterTest() OVERRIDE { | 2575 virtual void AfterTest() OVERRIDE { |
| 2575 EXPECT_EQ(4u, callbacks_.size()); | 2576 EXPECT_EQ(4u, callbacks_.size()); |
| 2576 } | 2577 } |
| 2577 | 2578 |
| 2578 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 2579 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 2580 OVERRIDE { |
| 2579 if (use_gl_renderer_) | 2581 if (use_gl_renderer_) |
| 2580 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); | 2582 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); |
| 2581 return FakeOutputSurface::CreateSoftware( | 2583 return FakeOutputSurface::CreateSoftware( |
| 2582 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); | 2584 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); |
| 2583 } | 2585 } |
| 2584 | 2586 |
| 2585 bool use_gl_renderer_; | 2587 bool use_gl_renderer_; |
| 2586 std::vector<gfx::Size> callbacks_; | 2588 std::vector<gfx::Size> callbacks_; |
| 2587 FakeContentLayerClient client_; | 2589 FakeContentLayerClient client_; |
| 2588 scoped_refptr<FakeContentLayer> root; | 2590 scoped_refptr<FakeContentLayer> root; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3106 LayerTreeHostTest::SetupTree(); | 3108 LayerTreeHostTest::SetupTree(); |
| 3107 } | 3109 } |
| 3108 | 3110 |
| 3109 virtual void BeginTest() OVERRIDE { | 3111 virtual void BeginTest() OVERRIDE { |
| 3110 did_initialize_gl_ = false; | 3112 did_initialize_gl_ = false; |
| 3111 did_release_gl_ = false; | 3113 did_release_gl_ = false; |
| 3112 last_source_frame_number_drawn_ = -1; // Never drawn. | 3114 last_source_frame_number_drawn_ = -1; // Never drawn. |
| 3113 PostSetNeedsCommitToMainThread(); | 3115 PostSetNeedsCommitToMainThread(); |
| 3114 } | 3116 } |
| 3115 | 3117 |
| 3116 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 3118 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 3119 OVERRIDE { |
| 3117 scoped_ptr<TestWebGraphicsContext3D> context3d( | 3120 scoped_ptr<TestWebGraphicsContext3D> context3d( |
| 3118 TestWebGraphicsContext3D::Create()); | 3121 TestWebGraphicsContext3D::Create()); |
| 3119 context3d->set_support_swapbuffers_complete_callback(false); | 3122 context3d->set_support_swapbuffers_complete_callback(false); |
| 3120 | 3123 |
| 3121 return FakeOutputSurface::CreateDeferredGL( | 3124 return FakeOutputSurface::CreateDeferredGL( |
| 3122 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)) | 3125 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)) |
| 3123 .PassAs<OutputSurface>(); | 3126 .PassAs<OutputSurface>(); |
| 3124 } | 3127 } |
| 3125 | 3128 |
| 3126 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 3129 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3952 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { | 3955 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { |
| 3953 RunTest(true, false, true); | 3956 RunTest(true, false, true); |
| 3954 } | 3957 } |
| 3955 | 3958 |
| 3956 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { | 3959 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { |
| 3957 RunTest(true, true, true); | 3960 RunTest(true, true, true); |
| 3958 } | 3961 } |
| 3959 | 3962 |
| 3960 } // namespace | 3963 } // namespace |
| 3961 } // namespace cc | 3964 } // namespace cc |
| OLD | NEW |