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

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

Issue 23503003: cc: Add readback and forced draw states to the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedReorg3
Patch Set: Address enne's commetns Created 7 years, 3 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
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 base::Unretained(layer_to_receive_animation))); 368 base::Unretained(layer_to_receive_animation)));
369 } 369 }
370 370
371 void LayerTreeTest::PostSetNeedsCommitToMainThread() { 371 void LayerTreeTest::PostSetNeedsCommitToMainThread() {
372 proxy()->MainThreadTaskRunner()->PostTask( 372 proxy()->MainThreadTaskRunner()->PostTask(
373 FROM_HERE, 373 FROM_HERE,
374 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit, 374 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit,
375 main_thread_weak_ptr_)); 375 main_thread_weak_ptr_));
376 } 376 }
377 377
378 void LayerTreeTest::PostReadbackToMainThread() {
379 proxy()->MainThreadTaskRunner()->PostTask(
380 FROM_HERE,
381 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_));
382 }
383
378 void LayerTreeTest::PostAcquireLayerTextures() { 384 void LayerTreeTest::PostAcquireLayerTextures() {
379 proxy()->MainThreadTaskRunner()->PostTask( 385 proxy()->MainThreadTaskRunner()->PostTask(
380 FROM_HERE, 386 FROM_HERE,
381 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures, 387 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures,
382 main_thread_weak_ptr_)); 388 main_thread_weak_ptr_));
383 } 389 }
384 390
385 void LayerTreeTest::PostSetNeedsRedrawToMainThread() { 391 void LayerTreeTest::PostSetNeedsRedrawToMainThread() {
386 proxy()->MainThreadTaskRunner()->PostTask( 392 proxy()->MainThreadTaskRunner()->PostTask(
387 FROM_HERE, 393 FROM_HERE,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 503 }
498 } 504 }
499 505
500 void LayerTreeTest::DispatchSetNeedsCommit() { 506 void LayerTreeTest::DispatchSetNeedsCommit() {
501 DCHECK(!proxy() || proxy()->IsMainThread()); 507 DCHECK(!proxy() || proxy()->IsMainThread());
502 508
503 if (layer_tree_host_) 509 if (layer_tree_host_)
504 layer_tree_host_->SetNeedsCommit(); 510 layer_tree_host_->SetNeedsCommit();
505 } 511 }
506 512
513 void LayerTreeTest::DispatchReadback() {
514 DCHECK(!proxy() || proxy()->IsMainThread());
515
516 if (layer_tree_host_) {
517 char pixels[4];
518 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1));
519 }
520 }
521
507 void LayerTreeTest::DispatchAcquireLayerTextures() { 522 void LayerTreeTest::DispatchAcquireLayerTextures() {
508 DCHECK(!proxy() || proxy()->IsMainThread()); 523 DCHECK(!proxy() || proxy()->IsMainThread());
509 524
510 if (layer_tree_host_) 525 if (layer_tree_host_)
511 layer_tree_host_->AcquireLayerTextures(); 526 layer_tree_host_->AcquireLayerTextures();
512 } 527 }
513 528
514 void LayerTreeTest::DispatchSetNeedsRedraw() { 529 void LayerTreeTest::DispatchSetNeedsRedraw() {
515 DCHECK(!proxy() || proxy()->IsMainThread()); 530 DCHECK(!proxy() || proxy()->IsMainThread());
516 531
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 646
632 scoped_refptr<cc::ContextProvider> LayerTreeTest:: 647 scoped_refptr<cc::ContextProvider> LayerTreeTest::
633 OffscreenContextProviderForCompositorThread() { 648 OffscreenContextProviderForCompositorThread() {
634 if (!compositor_thread_contexts_.get() || 649 if (!compositor_thread_contexts_.get() ||
635 compositor_thread_contexts_->DestroyedOnMainThread()) 650 compositor_thread_contexts_->DestroyedOnMainThread())
636 compositor_thread_contexts_ = TestContextProvider::Create(); 651 compositor_thread_contexts_ = TestContextProvider::Create();
637 return compositor_thread_contexts_; 652 return compositor_thread_contexts_;
638 } 653 }
639 654
640 } // namespace cc 655 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698