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

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

Issue 60513007: Add SwapPromise support to LayerTreeHost and LayerTreeImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: address Dana's comments Created 7 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/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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 main_thread_weak_ptr_, 386 main_thread_weak_ptr_,
387 base::Unretained(layer_to_receive_animation))); 387 base::Unretained(layer_to_receive_animation)));
388 } 388 }
389 389
390 void LayerTreeTest::PostSetNeedsCommitToMainThread() { 390 void LayerTreeTest::PostSetNeedsCommitToMainThread() {
391 main_task_runner_->PostTask(FROM_HERE, 391 main_task_runner_->PostTask(FROM_HERE,
392 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit, 392 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit,
393 main_thread_weak_ptr_)); 393 main_thread_weak_ptr_));
394 } 394 }
395 395
396 void LayerTreeTest::PostSetNeedsUpdateLayersToMainThread() {
397 main_task_runner_->PostTask(
398 FROM_HERE,
399 base::Bind(&LayerTreeTest::DispatchSetNeedsUpdateLayers,
400 main_thread_weak_ptr_));
401 }
402
396 void LayerTreeTest::PostReadbackToMainThread() { 403 void LayerTreeTest::PostReadbackToMainThread() {
397 main_task_runner_->PostTask( 404 main_task_runner_->PostTask(
398 FROM_HERE, 405 FROM_HERE,
399 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_)); 406 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_));
400 } 407 }
401 408
402 void LayerTreeTest::PostAcquireLayerTextures() { 409 void LayerTreeTest::PostAcquireLayerTextures() {
403 main_task_runner_->PostTask( 410 main_task_runner_->PostTask(
404 FROM_HERE, 411 FROM_HERE,
405 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures, 412 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 534 }
528 } 535 }
529 536
530 void LayerTreeTest::DispatchSetNeedsCommit() { 537 void LayerTreeTest::DispatchSetNeedsCommit() {
531 DCHECK(!proxy() || proxy()->IsMainThread()); 538 DCHECK(!proxy() || proxy()->IsMainThread());
532 539
533 if (layer_tree_host_) 540 if (layer_tree_host_)
534 layer_tree_host_->SetNeedsCommit(); 541 layer_tree_host_->SetNeedsCommit();
535 } 542 }
536 543
544 void LayerTreeTest::DispatchSetNeedsUpdateLayers() {
545 DCHECK(!proxy() || proxy()->IsMainThread());
546
547 if (layer_tree_host_)
548 layer_tree_host_->SetNeedsUpdateLayers();
549 }
550
537 void LayerTreeTest::DispatchReadback() { 551 void LayerTreeTest::DispatchReadback() {
538 DCHECK(!proxy() || proxy()->IsMainThread()); 552 DCHECK(!proxy() || proxy()->IsMainThread());
539 553
540 if (layer_tree_host_) { 554 if (layer_tree_host_) {
541 char pixels[4]; 555 char pixels[4];
542 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); 556 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1));
543 } 557 }
544 } 558 }
545 559
546 void LayerTreeTest::DispatchAcquireLayerTextures() { 560 void LayerTreeTest::DispatchAcquireLayerTextures() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } 682 }
669 683
670 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { 684 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() {
671 if (!compositor_contexts_.get() || 685 if (!compositor_contexts_.get() ||
672 compositor_contexts_->DestroyedOnMainThread()) 686 compositor_contexts_->DestroyedOnMainThread())
673 compositor_contexts_ = TestContextProvider::Create(); 687 compositor_contexts_ = TestContextProvider::Create();
674 return compositor_contexts_; 688 return compositor_contexts_;
675 } 689 }
676 690
677 } // namespace cc 691 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698