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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2409923002: cc: Rename SwapBuffers on CompositorFrameSink to SubmitCompositorFrame (Closed)
Patch Set: swap-to-submit: rebase Created 4 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_in_process.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink()); 126 CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink());
127 } 127 }
128 128
129 void TearDown() override { 129 void TearDown() override {
130 if (host_impl_) 130 if (host_impl_)
131 host_impl_->ReleaseCompositorFrameSink(); 131 host_impl_->ReleaseCompositorFrameSink();
132 } 132 }
133 133
134 void DidLoseCompositorFrameSinkOnImplThread() override {} 134 void DidLoseCompositorFrameSinkOnImplThread() override {}
135 void SetBeginFrameSource(BeginFrameSource* source) override {} 135 void SetBeginFrameSource(BeginFrameSource* source) override {}
136 void DidSwapBuffersCompleteOnImplThread() override {} 136 void DidReceiveCompositorFrameAckOnImplThread() override {}
137 void OnCanDrawStateChanged(bool can_draw) override { 137 void OnCanDrawStateChanged(bool can_draw) override {
138 on_can_draw_state_changed_called_ = true; 138 on_can_draw_state_changed_called_ = true;
139 } 139 }
140 void NotifyReadyToActivate() override { 140 void NotifyReadyToActivate() override {
141 did_notify_ready_to_activate_ = true; 141 did_notify_ready_to_activate_ = true;
142 host_impl_->ActivateSyncTree(); 142 host_impl_->ActivateSyncTree();
143 } 143 }
144 void NotifyReadyToDraw() override {} 144 void NotifyReadyToDraw() override {}
145 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; } 145 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; }
146 void SetNeedsOneBeginImplFrameOnImplThread() override { 146 void SetNeedsOneBeginImplFrameOnImplThread() override {
(...skipping 7764 matching lines...) Expand 10 before | Expand all | Expand 10 after
7911 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad( 7911 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad(
7912 device_layer_quad, clipped, force_aa); 7912 device_layer_quad, clipped, force_aa);
7913 EXPECT_FALSE(antialiased); 7913 EXPECT_FALSE(antialiased);
7914 7914
7915 host_impl_->DrawLayers(&frame); 7915 host_impl_->DrawLayers(&frame);
7916 host_impl_->DidDrawAllLayers(frame); 7916 host_impl_->DidDrawAllLayers(frame);
7917 } 7917 }
7918 7918
7919 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { 7919 class CompositorFrameMetadataTest : public LayerTreeHostImplTest {
7920 public: 7920 public:
7921 CompositorFrameMetadataTest() 7921 CompositorFrameMetadataTest() = default;
7922 : swap_buffers_complete_(0) {}
7923 7922
7924 void DidSwapBuffersCompleteOnImplThread() override { 7923 void DidReceiveCompositorFrameAckOnImplThread() override { acks_received_++; }
7925 swap_buffers_complete_++;
7926 }
7927 7924
7928 int swap_buffers_complete_; 7925 int acks_received_ = 0;
7929 }; 7926 };
7930 7927
7931 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) { 7928 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) {
7932 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); 7929 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
7933 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 7930 host_impl_->active_tree()->BuildPropertyTreesForTesting();
7934 { 7931 {
7935 LayerTreeHostImpl::FrameData frame; 7932 LayerTreeHostImpl::FrameData frame;
7936 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 7933 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
7937 host_impl_->DrawLayers(&frame); 7934 host_impl_->DrawLayers(&frame);
7938 host_impl_->DidDrawAllLayers(frame); 7935 host_impl_->DidDrawAllLayers(frame);
7939 } 7936 }
7940 host_impl_->ReclaimResources(ReturnedResourceArray()); 7937 host_impl_->ReclaimResources(ReturnedResourceArray());
7941 host_impl_->DidSwapBuffersComplete(); 7938 host_impl_->DidReceiveCompositorFrameAck();
7942 EXPECT_EQ(swap_buffers_complete_, 1); 7939 EXPECT_EQ(acks_received_, 1);
7943 } 7940 }
7944 7941
7945 class CountingSoftwareDevice : public SoftwareOutputDevice { 7942 class CountingSoftwareDevice : public SoftwareOutputDevice {
7946 public: 7943 public:
7947 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} 7944 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {}
7948 7945
7949 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override { 7946 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override {
7950 ++frames_began_; 7947 ++frames_began_;
7951 return SoftwareOutputDevice::BeginPaint(damage_rect); 7948 return SoftwareOutputDevice::BeginPaint(damage_rect);
7952 } 7949 }
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after
11406 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11403 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11407 11404
11408 // Re-initialize with a software output surface. 11405 // Re-initialize with a software output surface.
11409 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware(); 11406 compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware();
11410 host_impl_->InitializeRenderer(compositor_frame_sink_.get()); 11407 host_impl_->InitializeRenderer(compositor_frame_sink_.get());
11411 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11408 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11412 } 11409 }
11413 11410
11414 } // namespace 11411 } // namespace
11415 } // namespace cc 11412 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_in_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698