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

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

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: nits Created 6 years, 1 month 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 always_impl_thread_(&proxy_), 85 always_impl_thread_(&proxy_),
86 always_main_thread_blocked_(&proxy_), 86 always_main_thread_blocked_(&proxy_),
87 shared_bitmap_manager_(new TestSharedBitmapManager), 87 shared_bitmap_manager_(new TestSharedBitmapManager),
88 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager), 88 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager),
89 on_can_draw_state_changed_called_(false), 89 on_can_draw_state_changed_called_(false),
90 did_notify_ready_to_activate_(false), 90 did_notify_ready_to_activate_(false),
91 did_request_commit_(false), 91 did_request_commit_(false),
92 did_request_redraw_(false), 92 did_request_redraw_(false),
93 did_request_animate_(false), 93 did_request_animate_(false),
94 did_request_manage_tiles_(false), 94 did_request_manage_tiles_(false),
95 did_upload_visible_tile_(false),
96 reduce_memory_result_(true), 95 reduce_memory_result_(true),
97 current_limit_bytes_(0), 96 current_limit_bytes_(0),
98 current_priority_cutoff_value_(0) { 97 current_priority_cutoff_value_(0) {
99 media::InitializeMediaLibraryForTesting(); 98 media::InitializeMediaLibraryForTesting();
100 } 99 }
101 100
102 LayerTreeSettings DefaultSettings() { 101 LayerTreeSettings DefaultSettings() {
103 LayerTreeSettings settings; 102 LayerTreeSettings settings;
104 settings.minimum_occlusion_tracking_size = gfx::Size(); 103 settings.minimum_occlusion_tracking_size = gfx::Size();
105 settings.impl_side_painting = true; 104 settings.impl_side_painting = true;
(...skipping 25 matching lines...) Expand all
131 host_impl_->ActivateSyncTree(); 130 host_impl_->ActivateSyncTree();
132 } 131 }
133 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; } 132 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; }
134 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) override { 133 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) override {
135 did_request_redraw_ = true; 134 did_request_redraw_ = true;
136 } 135 }
137 void SetNeedsAnimateOnImplThread() override { did_request_animate_ = true; } 136 void SetNeedsAnimateOnImplThread() override { did_request_animate_ = true; }
138 void SetNeedsManageTilesOnImplThread() override { 137 void SetNeedsManageTilesOnImplThread() override {
139 did_request_manage_tiles_ = true; 138 did_request_manage_tiles_ = true;
140 } 139 }
141 void DidInitializeVisibleTileOnImplThread() override {
142 did_upload_visible_tile_ = true;
143 }
144 void SetNeedsCommitOnImplThread() override { did_request_commit_ = true; } 140 void SetNeedsCommitOnImplThread() override { did_request_commit_ = true; }
145 void PostAnimationEventsToMainThreadOnImplThread( 141 void PostAnimationEventsToMainThreadOnImplThread(
146 scoped_ptr<AnimationEventsVector> events) override {} 142 scoped_ptr<AnimationEventsVector> events) override {}
147 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, 143 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes,
148 int priority_cutoff) override { 144 int priority_cutoff) override {
149 current_limit_bytes_ = limit_bytes; 145 current_limit_bytes_ = limit_bytes;
150 current_priority_cutoff_value_ = priority_cutoff; 146 current_priority_cutoff_value_ = priority_cutoff;
151 return reduce_memory_result_; 147 return reduce_memory_result_;
152 } 148 }
153 bool IsInsideDraw() override { return false; } 149 bool IsInsideDraw() override { return false; }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 388 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
393 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 389 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
394 scoped_ptr<LayerTreeHostImpl> host_impl_; 390 scoped_ptr<LayerTreeHostImpl> host_impl_;
395 FakeRenderingStatsInstrumentation stats_instrumentation_; 391 FakeRenderingStatsInstrumentation stats_instrumentation_;
396 bool on_can_draw_state_changed_called_; 392 bool on_can_draw_state_changed_called_;
397 bool did_notify_ready_to_activate_; 393 bool did_notify_ready_to_activate_;
398 bool did_request_commit_; 394 bool did_request_commit_;
399 bool did_request_redraw_; 395 bool did_request_redraw_;
400 bool did_request_animate_; 396 bool did_request_animate_;
401 bool did_request_manage_tiles_; 397 bool did_request_manage_tiles_;
402 bool did_upload_visible_tile_;
403 bool reduce_memory_result_; 398 bool reduce_memory_result_;
404 base::Closure scrollbar_fade_start_; 399 base::Closure scrollbar_fade_start_;
405 base::TimeDelta requested_scrollbar_animation_delay_; 400 base::TimeDelta requested_scrollbar_animation_delay_;
406 size_t current_limit_bytes_; 401 size_t current_limit_bytes_;
407 int current_priority_cutoff_value_; 402 int current_priority_cutoff_value_;
408 }; 403 };
409 404
410 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 405 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
411 bool always_draw = false; 406 bool always_draw = false;
412 CheckNotifyCalledIfCanDrawChanged(always_draw); 407 CheckNotifyCalledIfCanDrawChanged(always_draw);
(...skipping 7135 matching lines...) Expand 10 before | Expand all | Expand 10 after
7548 // surface. 7543 // surface.
7549 EXPECT_EQ(0, num_lost_surfaces_); 7544 EXPECT_EQ(0, num_lost_surfaces_);
7550 host_impl_->DidLoseOutputSurface(); 7545 host_impl_->DidLoseOutputSurface();
7551 EXPECT_EQ(1, num_lost_surfaces_); 7546 EXPECT_EQ(1, num_lost_surfaces_);
7552 host_impl_->DidLoseOutputSurface(); 7547 host_impl_->DidLoseOutputSurface();
7553 EXPECT_LE(1, num_lost_surfaces_); 7548 EXPECT_LE(1, num_lost_surfaces_);
7554 } 7549 }
7555 7550
7556 } // namespace 7551 } // namespace
7557 } // namespace cc 7552 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698