Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: content/renderer/gpu/render_widget_compositor_unittest.cc

Issue 1985973002: Defer compositor context creation to the thread. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contextfactory: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« cc/test/test_context_provider.h ('K') | « cc/trees/layer_tree_host_unittest_copyrequest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698