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

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

Issue 22900018: cc: Set the mapped memory reclaim limit for the renderer compositor on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/max_bytes_pending_upload/max_transfer_buffer_usage_bytes/ Created 7 years, 4 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 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 #include <limits>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
12 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
13 #include "cc/debug/test_web_graphics_context_3d.h" 14 #include "cc/debug/test_web_graphics_context_3d.h"
14 #include "cc/input/top_controls_manager.h" 15 #include "cc/input/top_controls_manager.h"
15 #include "cc/layers/delegated_renderer_layer_impl.h" 16 #include "cc/layers/delegated_renderer_layer_impl.h"
16 #include "cc/layers/heads_up_display_layer_impl.h" 17 #include "cc/layers/heads_up_display_layer_impl.h"
17 #include "cc/layers/io_surface_layer_impl.h" 18 #include "cc/layers/io_surface_layer_impl.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 current_limit_bytes_(0), 77 current_limit_bytes_(0),
77 current_priority_cutoff_value_(0) { 78 current_priority_cutoff_value_(0) {
78 media::InitializeMediaLibraryForTesting(); 79 media::InitializeMediaLibraryForTesting();
79 } 80 }
80 81
81 virtual void SetUp() OVERRIDE { 82 virtual void SetUp() OVERRIDE {
82 LayerTreeSettings settings; 83 LayerTreeSettings settings;
83 settings.minimum_occlusion_tracking_size = gfx::Size(); 84 settings.minimum_occlusion_tracking_size = gfx::Size();
84 settings.impl_side_painting = true; 85 settings.impl_side_painting = true;
85 settings.solid_color_scrollbars = true; 86 settings.solid_color_scrollbars = true;
87 settings.max_transfer_buffer_usage_bytes
88 = std::numeric_limits<size_t>::max();
danakj 2013/08/23 01:21:46 nit: = on prev line, and all the other places this
kaanb 2013/08/23 01:37:31 Done.
86 89
87 host_impl_ = LayerTreeHostImpl::Create(settings, 90 host_impl_ = LayerTreeHostImpl::Create(settings,
88 this, 91 this,
89 &proxy_, 92 &proxy_,
90 &stats_instrumentation_); 93 &stats_instrumentation_);
91 host_impl_->InitializeRenderer(CreateOutputSurface()); 94 host_impl_->InitializeRenderer(CreateOutputSurface());
92 host_impl_->SetViewportSize(gfx::Size(10, 10)); 95 host_impl_->SetViewportSize(gfx::Size(10, 10));
93 } 96 }
94 97
95 virtual void TearDown() OVERRIDE {} 98 virtual void TearDown() OVERRIDE {}
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 }; 367 };
365 368
366 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 369 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
367 bool always_draw = false; 370 bool always_draw = false;
368 CheckNotifyCalledIfCanDrawChanged(always_draw); 371 CheckNotifyCalledIfCanDrawChanged(always_draw);
369 } 372 }
370 373
371 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { 374 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) {
372 LayerTreeSettings settings; 375 LayerTreeSettings settings;
373 settings.impl_side_painting = true; 376 settings.impl_side_painting = true;
377 settings.max_transfer_buffer_usage_bytes = std::numeric_limits<size_t>::max();
374 host_impl_ = LayerTreeHostImpl::Create( 378 host_impl_ = LayerTreeHostImpl::Create(
375 settings, this, &proxy_, &stats_instrumentation_); 379 settings, this, &proxy_, &stats_instrumentation_);
376 380
377 scoped_ptr<FakeOutputSurface> output_surface( 381 scoped_ptr<FakeOutputSurface> output_surface(
378 FakeOutputSurface::CreateAlwaysDrawAndSwap3d()); 382 FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
379 383
380 host_impl_->InitializeRenderer( 384 host_impl_->InitializeRenderer(
381 output_surface.PassAs<OutputSurface>()); 385 output_surface.PassAs<OutputSurface>());
382 host_impl_->SetViewportSize(gfx::Size(10, 10)); 386 host_impl_->SetViewportSize(gfx::Size(10, 10));
383 387
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 EXPECT_TRUE(layer1->quads_appended()); 2847 EXPECT_TRUE(layer1->quads_appended());
2844 host_impl_->DidDrawAllLayers(frame); 2848 host_impl_->DidDrawAllLayers(frame);
2845 } 2849 }
2846 2850
2847 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { 2851 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
2848 public: 2852 public:
2849 void CreateLayerTreeHostImpl(bool always_draw) { 2853 void CreateLayerTreeHostImpl(bool always_draw) {
2850 LayerTreeSettings settings; 2854 LayerTreeSettings settings;
2851 settings.minimum_occlusion_tracking_size = gfx::Size(); 2855 settings.minimum_occlusion_tracking_size = gfx::Size();
2852 settings.impl_side_painting = true; 2856 settings.impl_side_painting = true;
2857 settings.max_transfer_buffer_usage_bytes
2858 = std::numeric_limits<size_t>::max();
2853 host_impl_ = LayerTreeHostImpl::Create( 2859 host_impl_ = LayerTreeHostImpl::Create(
2854 settings, this, &proxy_, &stats_instrumentation_); 2860 settings, this, &proxy_, &stats_instrumentation_);
2855 2861
2856 scoped_ptr<FakeOutputSurface> output_surface; 2862 scoped_ptr<FakeOutputSurface> output_surface;
2857 if (always_draw) 2863 if (always_draw)
2858 output_surface = FakeOutputSurface::CreateAlwaysDrawAndSwap3d().Pass(); 2864 output_surface = FakeOutputSurface::CreateAlwaysDrawAndSwap3d().Pass();
2859 else 2865 else
2860 output_surface = FakeOutputSurface::Create3d().Pass(); 2866 output_surface = FakeOutputSurface::Create3d().Pass();
2861 2867
2862 host_impl_->InitializeRenderer(output_surface.PassAs<OutputSurface>()); 2868 host_impl_->InitializeRenderer(output_surface.PassAs<OutputSurface>());
(...skipping 3448 matching lines...) Expand 10 before | Expand all | Expand 10 after
6311 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); 6317 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id));
6312 EXPECT_EQ(0u, context3d->NumTextures()); 6318 EXPECT_EQ(0u, context3d->NumTextures());
6313 6319
6314 // Should not change state for multiple deletion on one UIResourceId 6320 // Should not change state for multiple deletion on one UIResourceId
6315 host_impl_->DeleteUIResource(ui_resource_id); 6321 host_impl_->DeleteUIResource(ui_resource_id);
6316 EXPECT_EQ(0u, context3d->NumTextures()); 6322 EXPECT_EQ(0u, context3d->NumTextures());
6317 } 6323 }
6318 6324
6319 } // namespace 6325 } // namespace
6320 } // namespace cc 6326 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698