| 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 27 matching lines...) Expand all Loading... |
| 38 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, | 38 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 39 const gfx::Vector2dF& outer_delta, | 39 const gfx::Vector2dF& outer_delta, |
| 40 const gfx::Vector2dF& elastic_overscroll_delta, | 40 const gfx::Vector2dF& elastic_overscroll_delta, |
| 41 float page_scale, | 41 float page_scale, |
| 42 float top_controls_delta) override {} | 42 float top_controls_delta) override {} |
| 43 void BeginMainFrame(double frame_time_sec) override {} | 43 void BeginMainFrame(double frame_time_sec) override {} |
| 44 std::unique_ptr<cc::OutputSurface> CreateOutputSurface( | 44 std::unique_ptr<cc::OutputSurface> CreateOutputSurface( |
| 45 bool fallback) override { | 45 bool fallback) override { |
| 46 return nullptr; | 46 return nullptr; |
| 47 } | 47 } |
| 48 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource() | |
| 49 override { | |
| 50 return nullptr; | |
| 51 } | |
| 52 void DidCommitAndDrawCompositorFrame() override {} | 48 void DidCommitAndDrawCompositorFrame() override {} |
| 53 void DidCommitCompositorFrame() override {} | 49 void DidCommitCompositorFrame() override {} |
| 54 void DidCompletePageScaleAnimation() override {} | 50 void DidCompletePageScaleAnimation() override {} |
| 55 void DidCompleteSwapBuffers() override {} | 51 void DidCompleteSwapBuffers() override {} |
| 56 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override {} | 52 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override {} |
| 57 bool IsClosing() const override { return false; } | 53 bool IsClosing() const override { return false; } |
| 58 void OnSwapBuffersAborted() override {} | 54 void OnSwapBuffersAborted() override {} |
| 59 void OnSwapBuffersComplete() override {} | 55 void OnSwapBuffersComplete() override {} |
| 60 void OnSwapBuffersPosted() override {} | 56 void OnSwapBuffersPosted() override {} |
| 61 void RequestScheduleAnimation() override {} | 57 void RequestScheduleAnimation() override {} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 if (!success) { | 84 if (!success) { |
| 89 context_provider->UnboundTestContext3d()->loseContextCHROMIUM( | 85 context_provider->UnboundTestContext3d()->loseContextCHROMIUM( |
| 90 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 86 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 91 } | 87 } |
| 92 | 88 |
| 93 // Create delegating surface so that max_pending_frames = 1. | 89 // Create delegating surface so that max_pending_frames = 1. |
| 94 return cc::FakeOutputSurface::CreateDelegating3d( | 90 return cc::FakeOutputSurface::CreateDelegating3d( |
| 95 std::move(context_provider)); | 91 std::move(context_provider)); |
| 96 } | 92 } |
| 97 | 93 |
| 98 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource() | |
| 99 override { | |
| 100 double refresh_rate = 200.0; | |
| 101 bool tick_automatically = true; | |
| 102 return base::MakeUnique<cc::FakeExternalBeginFrameSource>( | |
| 103 refresh_rate, tick_automatically); | |
| 104 } | |
| 105 | |
| 106 void add_success() { | 94 void add_success() { |
| 107 if (last_create_was_fallback_) | 95 if (last_create_was_fallback_) |
| 108 ++num_fallback_successes_; | 96 ++num_fallback_successes_; |
| 109 else | 97 else |
| 110 ++num_successes_; | 98 ++num_successes_; |
| 111 num_requests_since_last_success_ = 0; | 99 num_requests_since_last_success_ = 0; |
| 112 } | 100 } |
| 113 int num_successes() const { return num_successes_; } | 101 int num_successes() const { return num_successes_; } |
| 114 int num_fallback_successes() const { return num_fallback_successes_; } | 102 int num_fallback_successes() const { return num_fallback_successes_; } |
| 115 | 103 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 285 } |
| 298 | 286 |
| 299 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { | 287 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { |
| 300 // The first success is a fallback, but the next should not be a fallback. | 288 // The first success is a fallback, but the next should not be a fallback. |
| 301 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, | 289 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, |
| 302 1, 1); | 290 1, 1); |
| 303 } | 291 } |
| 304 | 292 |
| 305 } // namespace | 293 } // namespace |
| 306 } // namespace content | 294 } // namespace content |
| OLD | NEW |