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

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: Added screenshot sync test to telemetry unittests, updated cc unittest 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 413
414 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { 414 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) {
415 proxy()->MainThreadTaskRunner()->PostTask( 415 proxy()->MainThreadTaskRunner()->PostTask(
416 FROM_HERE, 416 FROM_HERE,
417 base::Bind(&LayerTreeTest::DispatchSetVisible, 417 base::Bind(&LayerTreeTest::DispatchSetVisible,
418 main_thread_weak_ptr_, 418 main_thread_weak_ptr_,
419 visible)); 419 visible));
420 } 420 }
421 421
422 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
423 proxy()->MainThreadTaskRunner()->PostTask(
424 FROM_HERE,
425 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw,
426 main_thread_weak_ptr_));
427 }
428
422 void LayerTreeTest::DoBeginTest() { 429 void LayerTreeTest::DoBeginTest() {
423 client_ = LayerTreeHostClientForTesting::Create(this); 430 client_ = LayerTreeHostClientForTesting::Create(this);
424 431
425 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); 432 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
426 layer_tree_host_ = LayerTreeHostForTesting::Create( 433 layer_tree_host_ = LayerTreeHostForTesting::Create(
427 this, 434 this,
428 client_.get(), 435 client_.get(),
429 settings_, 436 settings_,
430 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL); 437 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL);
431 ASSERT_TRUE(layer_tree_host_); 438 ASSERT_TRUE(layer_tree_host_);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return; 563 return;
557 564
558 layer_tree_host_->SetVisible(visible); 565 layer_tree_host_->SetVisible(visible);
559 566
560 // If the LTH is being made visible and a previous ScheduleComposite() was 567 // If the LTH is being made visible and a previous ScheduleComposite() was
561 // deferred because the LTH was not visible, re-schedule the composite now. 568 // deferred because the LTH was not visible, re-schedule the composite now.
562 if (layer_tree_host_->visible() && schedule_when_set_visible_true_) 569 if (layer_tree_host_->visible() && schedule_when_set_visible_true_)
563 ScheduleComposite(); 570 ScheduleComposite();
564 } 571 }
565 572
573 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
574 DCHECK(!proxy() || proxy()->IsMainThread());
575
576 if (layer_tree_host_)
577 layer_tree_host_->SetNextCommitForcesRedraw();
578 }
579
566 void LayerTreeTest::DispatchComposite() { 580 void LayerTreeTest::DispatchComposite() {
567 scheduled_ = false; 581 scheduled_ = false;
568 582
569 if (!layer_tree_host_) 583 if (!layer_tree_host_)
570 return; 584 return;
571 585
572 // If the LTH is not visible, defer the composite until the LTH is made 586 // If the LTH is not visible, defer the composite until the LTH is made
573 // visible. 587 // visible.
574 if (!layer_tree_host_->visible()) { 588 if (!layer_tree_host_->visible()) {
575 schedule_when_set_visible_true_ = true; 589 schedule_when_set_visible_true_ = true;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 668
655 scoped_refptr<cc::ContextProvider> LayerTreeTest:: 669 scoped_refptr<cc::ContextProvider> LayerTreeTest::
656 OffscreenContextProviderForCompositorThread() { 670 OffscreenContextProviderForCompositorThread() {
657 if (!compositor_thread_contexts_.get() || 671 if (!compositor_thread_contexts_.get() ||
658 compositor_thread_contexts_->DestroyedOnMainThread()) 672 compositor_thread_contexts_->DestroyedOnMainThread())
659 compositor_thread_contexts_ = TestContextProvider::Create(); 673 compositor_thread_contexts_ = TestContextProvider::Create();
660 return compositor_thread_contexts_; 674 return compositor_thread_contexts_;
661 } 675 }
662 676
663 } // namespace cc 677 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698