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

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

Issue 376683004: Pass resourceless software mode in BeginFrameArgs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix accidental header modification Created 6 years, 5 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 | Annotate | Revision Log
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 <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 5550 matching lines...) Expand 10 before | Expand all | Expand 10 after
5561 FakeOutputSurface* output_surface = 5561 FakeOutputSurface* output_surface =
5562 FakeOutputSurface::CreateDeferredGL( 5562 FakeOutputSurface::CreateDeferredGL(
5563 scoped_ptr<SoftwareOutputDevice>(software_device), 5563 scoped_ptr<SoftwareOutputDevice>(software_device),
5564 delegated_rendering).release(); 5564 delegated_rendering).release();
5565 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), 5565 EXPECT_TRUE(CreateHostImpl(DefaultSettings(),
5566 scoped_ptr<OutputSurface>(output_surface))); 5566 scoped_ptr<OutputSurface>(output_surface)));
5567 host_impl_->SetViewportSize(gfx::Size(50, 50)); 5567 host_impl_->SetViewportSize(gfx::Size(50, 50));
5568 5568
5569 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 5569 SetupScrollAndContentsLayers(gfx::Size(100, 100));
5570 5570
5571 output_surface->set_forced_draw_to_software_device(true); 5571 const gfx::Transform external_transform;
5572 EXPECT_TRUE(output_surface->ForcedDrawToSoftwareDevice()); 5572 const gfx::Rect external_viewport;
5573 const gfx::Rect external_clip;
5574 const bool resourceless_software_draw = true;
5575 host_impl_->SetExternalDrawConstraints(external_transform,
5576 external_viewport,
5577 external_clip,
5578 resourceless_software_draw);
5573 5579
5574 EXPECT_EQ(0, software_device->frames_began_); 5580 EXPECT_EQ(0, software_device->frames_began_);
5575 EXPECT_EQ(0, software_device->frames_ended_); 5581 EXPECT_EQ(0, software_device->frames_ended_);
5576 5582
5577 DrawFrame(); 5583 DrawFrame();
5578 5584
5579 EXPECT_EQ(1, software_device->frames_began_); 5585 EXPECT_EQ(1, software_device->frames_began_);
5580 EXPECT_EQ(1, software_device->frames_ended_); 5586 EXPECT_EQ(1, software_device->frames_ended_);
5581 5587
5582 // Call other API methods that are likely to hit NULL pointer in this mode. 5588 // Call other API methods that are likely to hit NULL pointer in this mode.
5583 EXPECT_TRUE(host_impl_->AsValue()); 5589 EXPECT_TRUE(host_impl_->AsValue());
5584 EXPECT_TRUE(host_impl_->ActivationStateAsValue()); 5590 EXPECT_TRUE(host_impl_->ActivationStateAsValue());
5585 } 5591 }
5586 5592
5587 TEST_F(LayerTreeHostImplTest, 5593 TEST_F(LayerTreeHostImplTest,
5588 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { 5594 ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) {
5589 set_reduce_memory_result(false); 5595 set_reduce_memory_result(false);
5590 bool delegated_rendering = false; 5596 bool delegated_rendering = false;
5591 FakeOutputSurface* output_surface = 5597 FakeOutputSurface* output_surface =
5592 FakeOutputSurface::CreateDeferredGL( 5598 FakeOutputSurface::CreateDeferredGL(
5593 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()), 5599 scoped_ptr<SoftwareOutputDevice>(new CountingSoftwareDevice()),
5594 delegated_rendering).release(); 5600 delegated_rendering).release();
5595 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), 5601 EXPECT_TRUE(CreateHostImpl(DefaultSettings(),
5596 scoped_ptr<OutputSurface>(output_surface))); 5602 scoped_ptr<OutputSurface>(output_surface)));
5597 5603
5598 output_surface->set_forced_draw_to_software_device(true); 5604 const gfx::Transform external_transform;
5599 EXPECT_TRUE(output_surface->ForcedDrawToSoftwareDevice()); 5605 const gfx::Rect external_viewport;
5606 const gfx::Rect external_clip;
5607 const bool resourceless_software_draw = true;
5608 host_impl_->SetExternalDrawConstraints(external_transform,
5609 external_viewport,
5610 external_clip,
5611 resourceless_software_draw);
5600 5612
5601 // SolidColorLayerImpl will be drawn. 5613 // SolidColorLayerImpl will be drawn.
5602 scoped_ptr<SolidColorLayerImpl> root_layer = 5614 scoped_ptr<SolidColorLayerImpl> root_layer =
5603 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); 5615 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
5604 5616
5605 // VideoLayerImpl will not be drawn. 5617 // VideoLayerImpl will not be drawn.
5606 FakeVideoFrameProvider provider; 5618 FakeVideoFrameProvider provider;
5607 scoped_ptr<VideoLayerImpl> video_layer = 5619 scoped_ptr<VideoLayerImpl> video_layer =
5608 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); 5620 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider);
5609 video_layer->SetBounds(gfx::Size(10, 10)); 5621 video_layer->SetBounds(gfx::Size(10, 10));
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
6627 300u * 1024u * 1024u); 6639 300u * 1024u * 1024u);
6628 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6640 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6629 150u * 1024u * 1024u); 6641 150u * 1024u * 1024u);
6630 } 6642 }
6631 6643
6632 TEST_F(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) { 6644 TEST_F(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) {
6633 const gfx::Size layer_size(100, 100); 6645 const gfx::Size layer_size(100, 100);
6634 gfx::Transform external_transform; 6646 gfx::Transform external_transform;
6635 const gfx::Rect external_viewport(layer_size); 6647 const gfx::Rect external_viewport(layer_size);
6636 const gfx::Rect external_clip(layer_size); 6648 const gfx::Rect external_clip(layer_size);
6637 const bool valid_for_tile_management = true; 6649 const bool resourceless_software_draw = false;
6638 LayerImpl* layer = SetupScrollAndContentsLayers(layer_size); 6650 LayerImpl* layer = SetupScrollAndContentsLayers(layer_size);
6639 6651
6640 host_impl_->SetExternalDrawConstraints(external_transform, 6652 host_impl_->SetExternalDrawConstraints(external_transform,
6641 external_viewport, 6653 external_viewport,
6642 external_clip, 6654 external_clip,
6643 valid_for_tile_management); 6655 resourceless_software_draw);
6644 DrawFrame(); 6656 DrawFrame();
6645 EXPECT_TRANSFORMATION_MATRIX_EQ( 6657 EXPECT_TRANSFORMATION_MATRIX_EQ(
6646 external_transform, layer->draw_properties().target_space_transform); 6658 external_transform, layer->draw_properties().target_space_transform);
6647 6659
6648 external_transform.Translate(20, 20); 6660 external_transform.Translate(20, 20);
6649 host_impl_->SetExternalDrawConstraints(external_transform, 6661 host_impl_->SetExternalDrawConstraints(external_transform,
6650 external_viewport, 6662 external_viewport,
6651 external_clip, 6663 external_clip,
6652 valid_for_tile_management); 6664 resourceless_software_draw);
6653 DrawFrame(); 6665 DrawFrame();
6654 EXPECT_TRANSFORMATION_MATRIX_EQ( 6666 EXPECT_TRANSFORMATION_MATRIX_EQ(
6655 external_transform, layer->draw_properties().target_space_transform); 6667 external_transform, layer->draw_properties().target_space_transform);
6656 } 6668 }
6657 6669
6658 } // namespace 6670 } // namespace
6659 } // namespace cc 6671 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698