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

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: . 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 always_impl_thread_(&proxy_), 84 always_impl_thread_(&proxy_),
85 always_main_thread_blocked_(&proxy_), 85 always_main_thread_blocked_(&proxy_),
86 shared_bitmap_manager_(new TestSharedBitmapManager), 86 shared_bitmap_manager_(new TestSharedBitmapManager),
87 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager), 87 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager),
88 on_can_draw_state_changed_called_(false), 88 on_can_draw_state_changed_called_(false),
89 did_notify_ready_to_activate_(false), 89 did_notify_ready_to_activate_(false),
90 did_request_commit_(false), 90 did_request_commit_(false),
91 did_request_redraw_(false), 91 did_request_redraw_(false),
92 did_request_animate_(false), 92 did_request_animate_(false),
93 did_request_manage_tiles_(false), 93 did_request_manage_tiles_(false),
94 did_upload_visible_tile_(false),
95 reduce_memory_result_(true), 94 reduce_memory_result_(true),
96 current_limit_bytes_(0), 95 current_limit_bytes_(0),
97 current_priority_cutoff_value_(0) { 96 current_priority_cutoff_value_(0) {
98 media::InitializeMediaLibraryForTesting(); 97 media::InitializeMediaLibraryForTesting();
99 } 98 }
100 99
101 LayerTreeSettings DefaultSettings() { 100 LayerTreeSettings DefaultSettings() {
102 LayerTreeSettings settings; 101 LayerTreeSettings settings;
103 settings.minimum_occlusion_tracking_size = gfx::Size(); 102 settings.minimum_occlusion_tracking_size = gfx::Size();
104 settings.impl_side_painting = true; 103 settings.impl_side_painting = true;
(...skipping 26 matching lines...) Expand all
131 } 130 }
132 void NotifyReadyToDraw() override {} 131 void NotifyReadyToDraw() override {}
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 7293 matching lines...) Expand 10 before | Expand all | Expand 10 after
7706 // surface. 7701 // surface.
7707 EXPECT_EQ(0, num_lost_surfaces_); 7702 EXPECT_EQ(0, num_lost_surfaces_);
7708 host_impl_->DidLoseOutputSurface(); 7703 host_impl_->DidLoseOutputSurface();
7709 EXPECT_EQ(1, num_lost_surfaces_); 7704 EXPECT_EQ(1, num_lost_surfaces_);
7710 host_impl_->DidLoseOutputSurface(); 7705 host_impl_->DidLoseOutputSurface();
7711 EXPECT_LE(1, num_lost_surfaces_); 7706 EXPECT_LE(1, num_lost_surfaces_);
7712 } 7707 }
7713 7708
7714 } // namespace 7709 } // namespace
7715 } // namespace cc 7710 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698