| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) { | 142 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) { |
| 143 EXPECT_EQ(num_requests_since_last_success_ > | 143 EXPECT_EQ(num_requests_since_last_success_ > |
| 144 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, | 144 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, |
| 145 fallback); | 145 fallback); |
| 146 last_create_was_fallback_ = fallback; | 146 last_create_was_fallback_ = fallback; |
| 147 bool success = num_failures_ >= num_failures_before_success_; | 147 bool success = num_failures_ >= num_failures_before_success_; |
| 148 if (success) { | 148 if (success) { |
| 149 std::unique_ptr<cc::TestWebGraphicsContext3D> context = | 149 std::unique_ptr<cc::TestWebGraphicsContext3D> context = |
| 150 cc::TestWebGraphicsContext3D::Create(); | 150 cc::TestWebGraphicsContext3D::Create(); |
| 151 // Image support required for synchronous compositing. | |
| 152 context->set_support_image(true); | |
| 153 // Create delegating surface so that max_pending_frames = 1. | 151 // Create delegating surface so that max_pending_frames = 1. |
| 154 return cc::FakeOutputSurface::CreateDelegating3d(std::move(context)); | 152 return cc::FakeOutputSurface::CreateDelegating3d(std::move(context)); |
| 155 } | 153 } |
| 156 return use_null_output_surface_ | 154 return use_null_output_surface_ |
| 157 ? nullptr | 155 ? nullptr |
| 158 : base::WrapUnique(new cc::FailureOutputSurface(true)); | 156 : base::WrapUnique(new cc::FailureOutputSurface(true)); |
| 159 } | 157 } |
| 160 | 158 |
| 161 // Force a new output surface to be created. | 159 // Force a new output surface to be created. |
| 162 void SynchronousComposite() { | 160 void SynchronousComposite() { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 320 } |
| 323 | 321 |
| 324 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { | 322 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { |
| 325 // The first success is a fallback, but the next should not be a fallback. | 323 // The first success is a fallback, but the next should not be a fallback. |
| 326 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, | 324 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, |
| 327 1, 1); | 325 1, 1); |
| 328 } | 326 } |
| 329 | 327 |
| 330 } // namespace | 328 } // namespace |
| 331 } // namespace content | 329 } // namespace content |
| OLD | NEW |