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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 23694031: Fix race conditions in window snapshot code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated unittest again, attempted to address feedback from jamesr@ Created 7 years, 2 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 | Annotate | Revision Log
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } 406 }
407 407
408 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { 408 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) {
409 proxy()->MainThreadTaskRunner()->PostTask( 409 proxy()->MainThreadTaskRunner()->PostTask(
410 FROM_HERE, 410 FROM_HERE,
411 base::Bind(&LayerTreeTest::DispatchSetVisible, 411 base::Bind(&LayerTreeTest::DispatchSetVisible,
412 main_thread_weak_ptr_, 412 main_thread_weak_ptr_,
413 visible)); 413 visible));
414 } 414 }
415 415
416 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
417 proxy()->MainThreadTaskRunner()->PostTask(
418 FROM_HERE,
419 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw,
420 main_thread_weak_ptr_));
421 }
422
416 void LayerTreeTest::DoBeginTest() { 423 void LayerTreeTest::DoBeginTest() {
417 client_ = LayerTreeHostClientForTesting::Create(this); 424 client_ = LayerTreeHostClientForTesting::Create(this);
418 425
419 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); 426 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
420 layer_tree_host_ = LayerTreeHostForTesting::Create( 427 layer_tree_host_ = LayerTreeHostForTesting::Create(
421 this, 428 this,
422 client_.get(), 429 client_.get(),
423 settings_, 430 settings_,
424 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL); 431 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL);
425 ASSERT_TRUE(layer_tree_host_); 432 ASSERT_TRUE(layer_tree_host_);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return; 557 return;
551 558
552 layer_tree_host_->SetVisible(visible); 559 layer_tree_host_->SetVisible(visible);
553 560
554 // If the LTH is being made visible and a previous ScheduleComposite() was 561 // If the LTH is being made visible and a previous ScheduleComposite() was
555 // deferred because the LTH was not visible, re-schedule the composite now. 562 // deferred because the LTH was not visible, re-schedule the composite now.
556 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) 563 if (layer_tree_host_->visible() && schedule_when_set_visible_true_)
557 ScheduleComposite(); 564 ScheduleComposite();
558 } 565 }
559 566
567 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
568 DCHECK(!proxy() || proxy()->IsMainThread());
569
570 if (layer_tree_host_)
571 layer_tree_host_->SetNextCommitForcesRedraw();
572 }
573
560 void LayerTreeTest::DispatchComposite() { 574 void LayerTreeTest::DispatchComposite() {
561 scheduled_ = false; 575 scheduled_ = false;
562 576
563 if (!layer_tree_host_) 577 if (!layer_tree_host_)
564 return; 578 return;
565 579
566 // If the LTH is not visible, defer the composite until the LTH is made 580 // If the LTH is not visible, defer the composite until the LTH is made
567 // visible. 581 // visible.
568 if (!layer_tree_host_->visible()) { 582 if (!layer_tree_host_->visible()) {
569 schedule_when_set_visible_true_ = true; 583 schedule_when_set_visible_true_ = true;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 650 }
637 651
638 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { 652 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() {
639 if (!compositor_contexts_.get() || 653 if (!compositor_contexts_.get() ||
640 compositor_contexts_->DestroyedOnMainThread()) 654 compositor_contexts_->DestroyedOnMainThread())
641 compositor_contexts_ = TestContextProvider::Create(); 655 compositor_contexts_ = TestContextProvider::Create();
642 return compositor_contexts_; 656 return compositor_contexts_;
643 } 657 }
644 658
645 } // namespace cc 659 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698