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

Side by Side Diff: cc/test/layer_tree_test.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: testfix 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
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/thread_blocker.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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 void DidSwapBuffersComplete() override { 253 void DidSwapBuffersComplete() override {
254 LayerTreeHostImpl::DidSwapBuffersComplete(); 254 LayerTreeHostImpl::DidSwapBuffersComplete();
255 test_hooks_->SwapBuffersCompleteOnThread(this); 255 test_hooks_->SwapBuffersCompleteOnThread(this);
256 } 256 }
257 257
258 void ReclaimResources(const CompositorFrameAck* ack) override { 258 void ReclaimResources(const CompositorFrameAck* ack) override {
259 LayerTreeHostImpl::ReclaimResources(ack); 259 LayerTreeHostImpl::ReclaimResources(ack);
260 } 260 }
261 261
262 void UpdateVisibleTiles() override {
263 LayerTreeHostImpl::UpdateVisibleTiles();
264 test_hooks_->UpdateVisibleTilesOnThread(this);
265 }
266
267 void NotifyReadyToActivate() override { 262 void NotifyReadyToActivate() override {
268 if (block_notify_ready_to_activate_for_testing_) { 263 if (block_notify_ready_to_activate_for_testing_) {
269 notify_ready_to_activate_was_blocked_ = true; 264 notify_ready_to_activate_was_blocked_ = true;
270 } else { 265 } else {
271 client_->NotifyReadyToActivate(); 266 LayerTreeHostImpl::NotifyReadyToActivate();
272 test_hooks_->NotifyReadyToActivateOnThread(this); 267 test_hooks_->NotifyReadyToActivateOnThread(this);
273 } 268 }
274 } 269 }
275 270
276 void NotifyReadyToDraw() override { 271 void NotifyReadyToDraw() override {
277 client_->NotifyReadyToDraw(); 272 LayerTreeHostImpl::NotifyReadyToDraw();
danakj 2014/11/12 20:50:35 Here's the fix for the unit test. The LayerTreeTes
278 test_hooks_->NotifyReadyToDrawOnThread(this); 273 test_hooks_->NotifyReadyToDrawOnThread(this);
279 } 274 }
280 275
281 void BlockNotifyReadyToActivateForTesting(bool block) override { 276 void BlockNotifyReadyToActivateForTesting(bool block) override {
282 CHECK(settings().impl_side_painting); 277 CHECK(settings().impl_side_painting);
283 CHECK(proxy()->ImplThreadTaskRunner()) 278 CHECK(proxy()->ImplThreadTaskRunner())
284 << "Not supported for single-threaded mode."; 279 << "Not supported for single-threaded mode.";
285 block_notify_ready_to_activate_for_testing_ = block; 280 block_notify_ready_to_activate_for_testing_ = block;
286 if (!block && notify_ready_to_activate_was_blocked_) { 281 if (!block && notify_ready_to_activate_was_blocked_) {
287 NotifyReadyToActivate(); 282 NotifyReadyToActivate();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 active_animation_controllers().begin(); 315 active_animation_controllers().begin();
321 for (; iter != active_animation_controllers().end(); ++iter) { 316 for (; iter != active_animation_controllers().end(); ++iter) {
322 if (iter->second->HasActiveAnimation()) { 317 if (iter->second->HasActiveAnimation()) {
323 has_unfinished_animation = true; 318 has_unfinished_animation = true;
324 break; 319 break;
325 } 320 }
326 } 321 }
327 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); 322 test_hooks_->UpdateAnimationState(this, has_unfinished_animation);
328 } 323 }
329 324
325 void NotifyTileStateChanged(const Tile* tile) override {
326 LayerTreeHostImpl::NotifyTileStateChanged(tile);
327 test_hooks_->NotifyTileStateChangedOnThread(this, tile);
328 }
329
330 private: 330 private:
331 TestHooks* test_hooks_; 331 TestHooks* test_hooks_;
332 bool block_notify_ready_to_activate_for_testing_; 332 bool block_notify_ready_to_activate_for_testing_;
333 bool notify_ready_to_activate_was_blocked_; 333 bool notify_ready_to_activate_was_blocked_;
334 }; 334 };
335 335
336 // Implementation of LayerTreeHost callback interface. 336 // Implementation of LayerTreeHost callback interface.
337 class LayerTreeHostClientForTesting : public LayerTreeHostClient, 337 class LayerTreeHostClientForTesting : public LayerTreeHostClient,
338 public LayerTreeHostSingleThreadClient { 338 public LayerTreeHostSingleThreadClient {
339 public: 339 public:
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // that the test should end the second BeginTest regains control. 506 // that the test should end the second BeginTest regains control.
507 if (beginning_) { 507 if (beginning_) {
508 end_when_begin_returns_ = true; 508 end_when_begin_returns_ = true;
509 } else { 509 } else {
510 main_task_runner_->PostTask( 510 main_task_runner_->PostTask(
511 FROM_HERE, 511 FROM_HERE,
512 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); 512 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_));
513 } 513 }
514 } 514 }
515 515
516 void LayerTreeTest::EndTestAfterDelay(int delay_milliseconds) { 516 void LayerTreeTest::EndTestAfterDelayMs(int delay_milliseconds) {
517 main_task_runner_->PostDelayedTask( 517 main_task_runner_->PostDelayedTask(
518 FROM_HERE, 518 FROM_HERE,
519 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_), 519 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_),
520 base::TimeDelta::FromMilliseconds(delay_milliseconds)); 520 base::TimeDelta::FromMilliseconds(delay_milliseconds));
521 } 521 }
522 522
523 void LayerTreeTest::PostAddAnimationToMainThread( 523 void LayerTreeTest::PostAddAnimationToMainThread(
524 Layer* layer_to_receive_animation) { 524 Layer* layer_to_receive_animation) {
525 main_task_runner_->PostTask( 525 main_task_runner_->PostTask(
526 FROM_HERE, 526 FROM_HERE,
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 return -1; 822 return -1;
823 } 823 }
824 824
825 void LayerTreeTest::DestroyLayerTreeHost() { 825 void LayerTreeTest::DestroyLayerTreeHost() {
826 if (layer_tree_host_ && layer_tree_host_->root_layer()) 826 if (layer_tree_host_ && layer_tree_host_->root_layer())
827 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 827 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
828 layer_tree_host_ = nullptr; 828 layer_tree_host_ = nullptr;
829 } 829 }
830 830
831 } // namespace cc 831 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/thread_blocker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698