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

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

Issue 23495022: CC: Add a scheduled action for ManageTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused. Created 7 years, 3 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_impl.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 <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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 public LayerTreeHostImplClient { 70 public LayerTreeHostImplClient {
71 public: 71 public:
72 LayerTreeHostImplTest() 72 LayerTreeHostImplTest()
73 : proxy_(), 73 : proxy_(),
74 always_impl_thread_(&proxy_), 74 always_impl_thread_(&proxy_),
75 always_main_thread_blocked_(&proxy_), 75 always_main_thread_blocked_(&proxy_),
76 on_can_draw_state_changed_called_(false), 76 on_can_draw_state_changed_called_(false),
77 did_notify_ready_to_activate_(false), 77 did_notify_ready_to_activate_(false),
78 did_request_commit_(false), 78 did_request_commit_(false),
79 did_request_redraw_(false), 79 did_request_redraw_(false),
80 did_request_manage_tiles_(false),
80 did_upload_visible_tile_(false), 81 did_upload_visible_tile_(false),
81 did_lose_output_surface_(false), 82 did_lose_output_surface_(false),
82 reduce_memory_result_(true), 83 reduce_memory_result_(true),
83 current_limit_bytes_(0), 84 current_limit_bytes_(0),
84 current_priority_cutoff_value_(0) { 85 current_priority_cutoff_value_(0) {
85 media::InitializeMediaLibraryForTesting(); 86 media::InitializeMediaLibraryForTesting();
86 } 87 }
87 88
88 virtual void SetUp() OVERRIDE { 89 virtual void SetUp() OVERRIDE {
89 LayerTreeSettings settings; 90 LayerTreeSettings settings;
(...skipping 23 matching lines...) Expand all
113 virtual void NotifyReadyToActivate() OVERRIDE { 114 virtual void NotifyReadyToActivate() OVERRIDE {
114 did_notify_ready_to_activate_ = true; 115 did_notify_ready_to_activate_ = true;
115 host_impl_->ActivatePendingTree(); 116 host_impl_->ActivatePendingTree();
116 } 117 }
117 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { 118 virtual void SetNeedsRedrawOnImplThread() OVERRIDE {
118 did_request_redraw_ = true; 119 did_request_redraw_ = true;
119 } 120 }
120 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { 121 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE {
121 did_request_redraw_ = true; 122 did_request_redraw_ = true;
122 } 123 }
124 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {
125 did_request_manage_tiles_ = true;
126 }
123 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { 127 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE {
124 did_upload_visible_tile_ = true; 128 did_upload_visible_tile_ = true;
125 } 129 }
126 virtual void SetNeedsCommitOnImplThread() OVERRIDE { 130 virtual void SetNeedsCommitOnImplThread() OVERRIDE {
127 did_request_commit_ = true; 131 did_request_commit_ = true;
128 } 132 }
129 virtual void PostAnimationEventsToMainThreadOnImplThread( 133 virtual void PostAnimationEventsToMainThreadOnImplThread(
130 scoped_ptr<AnimationEventsVector> events, 134 scoped_ptr<AnimationEventsVector> events,
131 base::Time wall_clock_time) OVERRIDE {} 135 base::Time wall_clock_time) OVERRIDE {}
132 virtual bool ReduceContentsTextureMemoryOnImplThread( 136 virtual bool ReduceContentsTextureMemoryOnImplThread(
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 FakeProxy proxy_; 357 FakeProxy proxy_;
354 DebugScopedSetImplThread always_impl_thread_; 358 DebugScopedSetImplThread always_impl_thread_;
355 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; 359 DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
356 360
357 scoped_ptr<LayerTreeHostImpl> host_impl_; 361 scoped_ptr<LayerTreeHostImpl> host_impl_;
358 FakeRenderingStatsInstrumentation stats_instrumentation_; 362 FakeRenderingStatsInstrumentation stats_instrumentation_;
359 bool on_can_draw_state_changed_called_; 363 bool on_can_draw_state_changed_called_;
360 bool did_notify_ready_to_activate_; 364 bool did_notify_ready_to_activate_;
361 bool did_request_commit_; 365 bool did_request_commit_;
362 bool did_request_redraw_; 366 bool did_request_redraw_;
367 bool did_request_manage_tiles_;
363 bool did_upload_visible_tile_; 368 bool did_upload_visible_tile_;
364 bool did_lose_output_surface_; 369 bool did_lose_output_surface_;
365 bool reduce_memory_result_; 370 bool reduce_memory_result_;
366 base::TimeDelta requested_scrollbar_animation_delay_; 371 base::TimeDelta requested_scrollbar_animation_delay_;
367 size_t current_limit_bytes_; 372 size_t current_limit_bytes_;
368 int current_priority_cutoff_value_; 373 int current_priority_cutoff_value_;
369 }; 374 };
370 375
371 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 376 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
372 bool always_draw = false; 377 bool always_draw = false;
(...skipping 6146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6519 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_); 6524 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_);
6520 host_impl_.reset(fake_host_impl_); 6525 host_impl_.reset(fake_host_impl_);
6521 host_impl_->InitializeRenderer(CreateOutputSurface()); 6526 host_impl_->InitializeRenderer(CreateOutputSurface());
6522 host_impl_->SetViewportSize(gfx::Size(10, 10)); 6527 host_impl_->SetViewportSize(gfx::Size(10, 10));
6523 } 6528 }
6524 6529
6525 FakeLayerTreeHostImpl* fake_host_impl_; 6530 FakeLayerTreeHostImpl* fake_host_impl_;
6526 }; 6531 };
6527 6532
6528 TEST_F(LayerTreeHostImplTestManageTiles, ManageTilesWhenInvisible) { 6533 TEST_F(LayerTreeHostImplTestManageTiles, ManageTilesWhenInvisible) {
6529 fake_host_impl_->SetNeedsManageTiles(); 6534 fake_host_impl_->DidModifyTilePriorities();
6530 EXPECT_TRUE(fake_host_impl_->manage_tiles_needed()); 6535 EXPECT_TRUE(fake_host_impl_->manage_tiles_needed());
6531 fake_host_impl_->SetVisible(false); 6536 fake_host_impl_->SetVisible(false);
6532 EXPECT_FALSE(fake_host_impl_->manage_tiles_needed()); 6537 EXPECT_FALSE(fake_host_impl_->manage_tiles_needed());
6533 } 6538 }
6534 6539
6535 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { 6540 TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
6536 scoped_ptr<TestWebGraphicsContext3D> context = 6541 scoped_ptr<TestWebGraphicsContext3D> context =
6537 TestWebGraphicsContext3D::Create(); 6542 TestWebGraphicsContext3D::Create();
6538 TestWebGraphicsContext3D* context3d = context.get(); 6543 TestWebGraphicsContext3D* context3d = context.get();
6539 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); 6544 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
6616 host_impl_.reset(); 6621 host_impl_.reset();
6617 6622
6618 // The CopyOutputResult's callback was cancelled, the CopyOutputResult 6623 // The CopyOutputResult's callback was cancelled, the CopyOutputResult
6619 // released, and the texture deleted. 6624 // released, and the texture deleted.
6620 EXPECT_TRUE(context_provider->HasOneRef()); 6625 EXPECT_TRUE(context_provider->HasOneRef());
6621 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures()); 6626 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures());
6622 } 6627 }
6623 6628
6624 } // namespace 6629 } // namespace
6625 } // namespace cc 6630 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698