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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 bool success = num_failures_ >= num_failures_before_success_; | 80 bool success = num_failures_ >= num_failures_before_success_; |
81 if (!success && use_null_compositor_frame_sink_) | 81 if (!success && use_null_compositor_frame_sink_) |
82 return nullptr; | 82 return nullptr; |
83 | 83 |
84 auto context_provider = cc::TestContextProvider::Create(); | 84 auto context_provider = cc::TestContextProvider::Create(); |
85 if (!success) { | 85 if (!success) { |
86 context_provider->UnboundTestContext3d()->loseContextCHROMIUM( | 86 context_provider->UnboundTestContext3d()->loseContextCHROMIUM( |
87 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 87 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
88 } | 88 } |
89 | 89 return cc::FakeCompositorFrameSink::Create3d(std::move(context_provider)); |
90 auto s = cc::FakeCompositorFrameSink::Create3d(std::move(context_provider)); | |
91 EXPECT_EQ(1, s->capabilities().max_frames_pending); | |
92 return std::move(s); | |
93 } | 90 } |
94 | 91 |
95 void add_success() { | 92 void add_success() { |
96 if (last_create_was_fallback_) | 93 if (last_create_was_fallback_) |
97 ++num_fallback_successes_; | 94 ++num_fallback_successes_; |
98 else | 95 else |
99 ++num_successes_; | 96 ++num_successes_; |
100 num_requests_since_last_success_ = 0; | 97 num_requests_since_last_success_ = 0; |
101 } | 98 } |
102 int num_successes() const { return num_successes_; } | 99 int num_successes() const { return num_successes_; } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 292 |
296 TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNormalSuccess) { | 293 TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNormalSuccess) { |
297 // The first success is a fallback, but the next should not be a fallback. | 294 // The first success is a fallback, but the next should not be a fallback. |
298 RunTest(false, | 295 RunTest(false, |
299 RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, | 296 RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, |
300 1, 1); | 297 1, 1); |
301 } | 298 } |
302 | 299 |
303 } // namespace | 300 } // namespace |
304 } // namespace content | 301 } // namespace content |
OLD | NEW |