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

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: comments 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 26 matching lines...) Expand all
132 } 131 }
133 void NotifyReadyToDraw() override {} 132 void NotifyReadyToDraw() override {}
134 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; } 133 void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; }
135 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) override { 134 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) override {
136 did_request_redraw_ = true; 135 did_request_redraw_ = true;
137 } 136 }
138 void SetNeedsAnimateOnImplThread() override { did_request_animate_ = true; } 137 void SetNeedsAnimateOnImplThread() override { did_request_animate_ = true; }
139 void SetNeedsManageTilesOnImplThread() override { 138 void SetNeedsManageTilesOnImplThread() override {
140 did_request_manage_tiles_ = true; 139 did_request_manage_tiles_ = true;
141 } 140 }
142 void DidInitializeVisibleTileOnImplThread() override {
143 did_upload_visible_tile_ = true;
144 }
145 void SetNeedsCommitOnImplThread() override { did_request_commit_ = true; } 141 void SetNeedsCommitOnImplThread() override { did_request_commit_ = true; }
146 void PostAnimationEventsToMainThreadOnImplThread( 142 void PostAnimationEventsToMainThreadOnImplThread(
147 scoped_ptr<AnimationEventsVector> events) override {} 143 scoped_ptr<AnimationEventsVector> events) override {}
148 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, 144 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes,
149 int priority_cutoff) override { 145 int priority_cutoff) override {
150 current_limit_bytes_ = limit_bytes; 146 current_limit_bytes_ = limit_bytes;
151 current_priority_cutoff_value_ = priority_cutoff; 147 current_priority_cutoff_value_ = priority_cutoff;
152 return reduce_memory_result_; 148 return reduce_memory_result_;
153 } 149 }
154 bool IsInsideDraw() override { return false; } 150 bool IsInsideDraw() override { return false; }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 389 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
394 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 390 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
395 scoped_ptr<LayerTreeHostImpl> host_impl_; 391 scoped_ptr<LayerTreeHostImpl> host_impl_;
396 FakeRenderingStatsInstrumentation stats_instrumentation_; 392 FakeRenderingStatsInstrumentation stats_instrumentation_;
397 bool on_can_draw_state_changed_called_; 393 bool on_can_draw_state_changed_called_;
398 bool did_notify_ready_to_activate_; 394 bool did_notify_ready_to_activate_;
399 bool did_request_commit_; 395 bool did_request_commit_;
400 bool did_request_redraw_; 396 bool did_request_redraw_;
401 bool did_request_animate_; 397 bool did_request_animate_;
402 bool did_request_manage_tiles_; 398 bool did_request_manage_tiles_;
403 bool did_upload_visible_tile_;
404 bool reduce_memory_result_; 399 bool reduce_memory_result_;
405 base::Closure scrollbar_fade_start_; 400 base::Closure scrollbar_fade_start_;
406 base::TimeDelta requested_scrollbar_animation_delay_; 401 base::TimeDelta requested_scrollbar_animation_delay_;
407 size_t current_limit_bytes_; 402 size_t current_limit_bytes_;
408 int current_priority_cutoff_value_; 403 int current_priority_cutoff_value_;
409 }; 404 };
410 405
411 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 406 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
412 bool always_draw = false; 407 bool always_draw = false;
413 CheckNotifyCalledIfCanDrawChanged(always_draw); 408 CheckNotifyCalledIfCanDrawChanged(always_draw);
(...skipping 7134 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