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 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "cc/base/math_util.h" | 15 #include "cc/base/math_util.h" |
16 #include "cc/output/copy_output_request.h" | 16 #include "cc/output/copy_output_request.h" |
17 #include "cc/output/copy_output_result.h" | 17 #include "cc/output/copy_output_result.h" |
| 18 #include "cc/output/output_surface_frame.h" |
18 #include "cc/output/overlay_strategy_single_on_top.h" | 19 #include "cc/output/overlay_strategy_single_on_top.h" |
19 #include "cc/output/overlay_strategy_underlay.h" | 20 #include "cc/output/overlay_strategy_underlay.h" |
20 #include "cc/output/texture_mailbox_deleter.h" | 21 #include "cc/output/texture_mailbox_deleter.h" |
21 #include "cc/quads/texture_draw_quad.h" | 22 #include "cc/quads/texture_draw_quad.h" |
22 #include "cc/resources/resource_provider.h" | 23 #include "cc/resources/resource_provider.h" |
23 #include "cc/test/fake_impl_task_runner_provider.h" | 24 #include "cc/test/fake_impl_task_runner_provider.h" |
24 #include "cc/test/fake_layer_tree_host_impl.h" | 25 #include "cc/test/fake_layer_tree_host_impl.h" |
25 #include "cc/test/fake_output_surface.h" | 26 #include "cc/test/fake_output_surface.h" |
26 #include "cc/test/fake_output_surface_client.h" | 27 #include "cc/test/fake_output_surface_client.h" |
27 #include "cc/test/fake_resource_provider.h" | 28 #include "cc/test/fake_resource_provider.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 346 |
346 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 347 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
347 resource_provider_ = FakeResourceProvider::Create( | 348 resource_provider_ = FakeResourceProvider::Create( |
348 output_surface_->context_provider(), shared_bitmap_manager_.get()); | 349 output_surface_->context_provider(), shared_bitmap_manager_.get()); |
349 renderer_ = base::MakeUnique<FakeRendererGL>( | 350 renderer_ = base::MakeUnique<FakeRendererGL>( |
350 &settings_, output_surface_.get(), resource_provider_.get()); | 351 &settings_, output_surface_.get(), resource_provider_.get()); |
351 renderer_->Initialize(); | 352 renderer_->Initialize(); |
352 renderer_->SetVisible(true); | 353 renderer_->SetVisible(true); |
353 } | 354 } |
354 | 355 |
355 void SwapBuffers() { renderer_->SwapBuffers(std::vector<ui::LatencyInfo>()); } | 356 void SwapBuffers() { renderer_->SwapBuffers(OutputSurfaceFrame()); } |
356 | 357 |
357 RendererSettings settings_; | 358 RendererSettings settings_; |
358 FakeOutputSurfaceClient output_surface_client_; | 359 FakeOutputSurfaceClient output_surface_client_; |
359 std::unique_ptr<FakeOutputSurface> output_surface_; | 360 std::unique_ptr<FakeOutputSurface> output_surface_; |
360 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; | 361 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
361 std::unique_ptr<ResourceProvider> resource_provider_; | 362 std::unique_ptr<ResourceProvider> resource_provider_; |
362 std::unique_ptr<FakeRendererGL> renderer_; | 363 std::unique_ptr<FakeRendererGL> renderer_; |
363 }; | 364 }; |
364 | 365 |
365 // Closing the namespace here so that GLRendererShaderTest can take advantage | 366 // Closing the namespace here so that GLRendererShaderTest can take advantage |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 renderer_.reset(new FakeRendererGL(&settings_, output_surface_.get(), | 1521 renderer_.reset(new FakeRendererGL(&settings_, output_surface_.get(), |
1521 resource_provider_.get())); | 1522 resource_provider_.get())); |
1522 EXPECT_CALL(*output_surface_, GetOverlayCandidateValidator()).Times(1); | 1523 EXPECT_CALL(*output_surface_, GetOverlayCandidateValidator()).Times(1); |
1523 renderer_->Initialize(); | 1524 renderer_->Initialize(); |
1524 | 1525 |
1525 EXPECT_CALL(*output_surface_, EnsureBackbuffer()).Times(1); | 1526 EXPECT_CALL(*output_surface_, EnsureBackbuffer()).Times(1); |
1526 renderer_->SetVisible(true); | 1527 renderer_->SetVisible(true); |
1527 Mock::VerifyAndClearExpectations(output_surface_.get()); | 1528 Mock::VerifyAndClearExpectations(output_surface_.get()); |
1528 } | 1529 } |
1529 | 1530 |
1530 void SwapBuffers() { renderer_->SwapBuffers(std::vector<ui::LatencyInfo>()); } | 1531 void SwapBuffers() { renderer_->SwapBuffers(OutputSurfaceFrame()); } |
1531 | 1532 |
1532 void DrawFrame(float device_scale_factor, | 1533 void DrawFrame(float device_scale_factor, |
1533 const gfx::Size& viewport_size, | 1534 const gfx::Size& viewport_size, |
1534 bool transparent) { | 1535 bool transparent) { |
1535 int render_pass_id = 1; | 1536 int render_pass_id = 1; |
1536 RenderPass* render_pass = | 1537 RenderPass* render_pass = |
1537 AddRenderPass(&render_passes_in_draw_order_, render_pass_id, | 1538 AddRenderPass(&render_passes_in_draw_order_, render_pass_id, |
1538 gfx::Rect(viewport_size), gfx::Transform()); | 1539 gfx::Rect(viewport_size), gfx::Transform()); |
1539 AddQuad(render_pass, gfx::Rect(viewport_size), SK_ColorGREEN); | 1540 AddQuad(render_pass, gfx::Rect(viewport_size), SK_ColorGREEN); |
1540 render_pass->has_transparent_background = transparent; | 1541 render_pass->has_transparent_background = transparent; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 renderer_->SetVisible(true); | 1978 renderer_->SetVisible(true); |
1978 Mock::VerifyAndClearExpectations(context_support_ptr_); | 1979 Mock::VerifyAndClearExpectations(context_support_ptr_); |
1979 | 1980 |
1980 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); | 1981 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); |
1981 renderer_->SetVisible(false); | 1982 renderer_->SetVisible(false); |
1982 Mock::VerifyAndClearExpectations(context_support_ptr_); | 1983 Mock::VerifyAndClearExpectations(context_support_ptr_); |
1983 } | 1984 } |
1984 | 1985 |
1985 } // namespace | 1986 } // namespace |
1986 } // namespace cc | 1987 } // namespace cc |
OLD | NEW |