OLD | NEW |
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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 class GLRendererWithDefaultHarnessTest : public GLRendererTest { | 345 class GLRendererWithDefaultHarnessTest : public GLRendererTest { |
346 protected: | 346 protected: |
347 GLRendererWithDefaultHarnessTest() { | 347 GLRendererWithDefaultHarnessTest() { |
348 output_surface_ = | 348 output_surface_ = |
349 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); | 349 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); |
350 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 350 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
351 | 351 |
352 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 352 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
353 resource_provider_ = FakeResourceProvider::Create( | 353 resource_provider_ = FakeResourceProvider::Create( |
354 output_surface_.get(), shared_bitmap_manager_.get()); | 354 output_surface_.get(), shared_bitmap_manager_.get()); |
355 renderer_ = base::WrapUnique(new FakeRendererGL( | 355 renderer_ = base::MakeUnique<FakeRendererGL>( |
356 &settings_, output_surface_.get(), resource_provider_.get())); | 356 &settings_, output_surface_.get(), resource_provider_.get()); |
357 renderer_->Initialize(); | 357 renderer_->Initialize(); |
358 renderer_->SetVisible(true); | 358 renderer_->SetVisible(true); |
359 } | 359 } |
360 | 360 |
361 void SwapBuffers() { renderer_->SwapBuffers(CompositorFrameMetadata()); } | 361 void SwapBuffers() { renderer_->SwapBuffers(CompositorFrameMetadata()); } |
362 | 362 |
363 RendererSettings settings_; | 363 RendererSettings settings_; |
364 FakeOutputSurfaceClient output_surface_client_; | 364 FakeOutputSurfaceClient output_surface_client_; |
365 std::unique_ptr<FakeOutputSurface> output_surface_; | 365 std::unique_ptr<FakeOutputSurface> output_surface_; |
366 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; | 366 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 .WillOnce(::testing::Return(true)); | 1872 .WillOnce(::testing::Return(true)); |
1873 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _)).Times(0); | 1873 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _)).Times(0); |
1874 DrawFrame(&renderer, viewport_rect); | 1874 DrawFrame(&renderer, viewport_rect); |
1875 } | 1875 } |
1876 | 1876 |
1877 class SingleOverlayOnTopProcessor : public OverlayProcessor { | 1877 class SingleOverlayOnTopProcessor : public OverlayProcessor { |
1878 public: | 1878 public: |
1879 class SingleOverlayValidator : public OverlayCandidateValidator { | 1879 class SingleOverlayValidator : public OverlayCandidateValidator { |
1880 public: | 1880 public: |
1881 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 1881 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
1882 strategies->push_back( | 1882 strategies->push_back(base::MakeUnique<OverlayStrategySingleOnTop>(this)); |
1883 base::WrapUnique(new OverlayStrategySingleOnTop(this))); | 1883 strategies->push_back(base::MakeUnique<OverlayStrategyUnderlay>(this)); |
1884 strategies->push_back( | |
1885 base::WrapUnique(new OverlayStrategyUnderlay(this))); | |
1886 } | 1884 } |
1887 | 1885 |
1888 bool AllowCALayerOverlays() override { return false; } | 1886 bool AllowCALayerOverlays() override { return false; } |
1889 | 1887 |
1890 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { | 1888 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { |
1891 ASSERT_EQ(1U, surfaces->size()); | 1889 ASSERT_EQ(1U, surfaces->size()); |
1892 OverlayCandidate& candidate = surfaces->back(); | 1890 OverlayCandidate& candidate = surfaces->back(); |
1893 candidate.overlay_handled = true; | 1891 candidate.overlay_handled = true; |
1894 } | 1892 } |
1895 }; | 1893 }; |
1896 | 1894 |
1897 explicit SingleOverlayOnTopProcessor(OutputSurface* surface) | 1895 explicit SingleOverlayOnTopProcessor(OutputSurface* surface) |
1898 : OverlayProcessor(surface) {} | 1896 : OverlayProcessor(surface) {} |
1899 | 1897 |
1900 void Initialize() override { | 1898 void Initialize() override { |
1901 strategies_.push_back( | 1899 strategies_.push_back( |
1902 base::WrapUnique(new OverlayStrategySingleOnTop(&validator_))); | 1900 base::MakeUnique<OverlayStrategySingleOnTop>(&validator_)); |
1903 } | 1901 } |
1904 | 1902 |
1905 SingleOverlayValidator validator_; | 1903 SingleOverlayValidator validator_; |
1906 }; | 1904 }; |
1907 | 1905 |
1908 class WaitSyncTokenCountingContext : public TestWebGraphicsContext3D { | 1906 class WaitSyncTokenCountingContext : public TestWebGraphicsContext3D { |
1909 public: | 1907 public: |
1910 MOCK_METHOD1(waitSyncToken, void(const GLbyte* sync_token)); | 1908 MOCK_METHOD1(waitSyncToken, void(const GLbyte* sync_token)); |
1911 }; | 1909 }; |
1912 | 1910 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) | 2142 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) |
2145 .WillOnce(Return(false)); | 2143 .WillOnce(Return(false)); |
2146 EXPECT_CALL(*context_provider_, DeleteCachedResources()); | 2144 EXPECT_CALL(*context_provider_, DeleteCachedResources()); |
2147 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); | 2145 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); |
2148 renderer_->SetVisible(false); | 2146 renderer_->SetVisible(false); |
2149 Mock::VerifyAndClearExpectations(context_support_ptr_); | 2147 Mock::VerifyAndClearExpectations(context_support_ptr_); |
2150 } | 2148 } |
2151 | 2149 |
2152 } // namespace | 2150 } // namespace |
2153 } // namespace cc | 2151 } // namespace cc |
OLD | NEW |