| OLD | NEW |
| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 4409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4420 SwapPromise::DidNotSwapReason reason; | 4420 SwapPromise::DidNotSwapReason reason; |
| 4421 base::Lock lock; | 4421 base::Lock lock; |
| 4422 }; | 4422 }; |
| 4423 | 4423 |
| 4424 class TestSwapPromise : public SwapPromise { | 4424 class TestSwapPromise : public SwapPromise { |
| 4425 public: | 4425 public: |
| 4426 explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {} | 4426 explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {} |
| 4427 | 4427 |
| 4428 virtual ~TestSwapPromise() { | 4428 virtual ~TestSwapPromise() { |
| 4429 base::AutoLock lock(result_->lock); | 4429 base::AutoLock lock(result_->lock); |
| 4430 LOG(ERROR) << "~TestSwapPromise() " | |
| 4431 << " did_swap_called " << result_->did_swap_called | |
| 4432 << " did_not_swap_called " << result_->did_not_swap_called | |
| 4433 << " result addr " << result_; | |
| 4434 result_->dtor_called = true; | 4430 result_->dtor_called = true; |
| 4435 } | 4431 } |
| 4436 | 4432 |
| 4437 virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE { | 4433 virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE { |
| 4438 base::AutoLock lock(result_->lock); | 4434 base::AutoLock lock(result_->lock); |
| 4439 LOG(ERROR) << "TestSwapPromise::DidSwap " | |
| 4440 << " did_swap_called " << result_->did_swap_called | |
| 4441 << " did_not_swap_called " << result_->did_not_swap_called | |
| 4442 << " result addr " << result_; | |
| 4443 EXPECT_FALSE(result_->did_swap_called); | 4435 EXPECT_FALSE(result_->did_swap_called); |
| 4444 EXPECT_FALSE(result_->did_not_swap_called); | 4436 EXPECT_FALSE(result_->did_not_swap_called); |
| 4445 result_->did_swap_called = true; | 4437 result_->did_swap_called = true; |
| 4446 } | 4438 } |
| 4447 | 4439 |
| 4448 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 4440 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
| 4449 base::AutoLock lock(result_->lock); | 4441 base::AutoLock lock(result_->lock); |
| 4450 LOG(ERROR) << "TestSwapPromise::DidNotSwap " | |
| 4451 << " reason " << reason | |
| 4452 << " did_swap_called " << result_->did_swap_called | |
| 4453 << " did_not_swap_called " << result_->did_not_swap_called | |
| 4454 << " result addr " << result_; | |
| 4455 EXPECT_FALSE(result_->did_swap_called); | 4442 EXPECT_FALSE(result_->did_swap_called); |
| 4456 EXPECT_FALSE(result_->did_not_swap_called); | 4443 EXPECT_FALSE(result_->did_not_swap_called); |
| 4457 result_->did_not_swap_called = true; | 4444 result_->did_not_swap_called = true; |
| 4458 result_->reason = reason; | 4445 result_->reason = reason; |
| 4459 } | 4446 } |
| 4460 | 4447 |
| 4461 virtual int64 TraceId() const OVERRIDE { return 0; } | 4448 virtual int64 TraceId() const OVERRIDE { return 0; } |
| 4462 | 4449 |
| 4463 private: | 4450 private: |
| 4464 // Not owned. | 4451 // Not owned. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4529 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); | 4516 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); |
| 4530 EXPECT_TRUE(swap_promise_result_[2].dtor_called); | 4517 EXPECT_TRUE(swap_promise_result_[2].dtor_called); |
| 4531 } | 4518 } |
| 4532 } | 4519 } |
| 4533 | 4520 |
| 4534 int commit_count_; | 4521 int commit_count_; |
| 4535 int commit_complete_count_; | 4522 int commit_complete_count_; |
| 4536 TestSwapPromiseResult swap_promise_result_[3]; | 4523 TestSwapPromiseResult swap_promise_result_[3]; |
| 4537 }; | 4524 }; |
| 4538 | 4525 |
| 4539 // TODO(miletus): Flaky test: crbug.com/393995 | |
| 4540 // Enabled with verbose logging information. | |
| 4541 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4526 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
| 4542 | 4527 |
| 4543 class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit | 4528 class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit |
| 4544 : public LayerTreeHostTest { | 4529 : public LayerTreeHostTest { |
| 4545 protected: | 4530 protected: |
| 4546 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4531 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 4547 | 4532 |
| 4548 virtual void DidCommit() OVERRIDE { | 4533 virtual void DidCommit() OVERRIDE { |
| 4549 layer_tree_host()->SetDeferCommits(true); | 4534 layer_tree_host()->SetDeferCommits(true); |
| 4550 layer_tree_host()->SetNeedsCommit(); | 4535 layer_tree_host()->SetNeedsCommit(); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5033 const gfx::Size bounds_; | 5018 const gfx::Size bounds_; |
| 5034 FakeContentLayerClient client_; | 5019 FakeContentLayerClient client_; |
| 5035 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5020 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5036 scoped_refptr<FakePictureLayer> picture_layer_; | 5021 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5037 Layer* child_layer_; | 5022 Layer* child_layer_; |
| 5038 }; | 5023 }; |
| 5039 | 5024 |
| 5040 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5025 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5041 | 5026 |
| 5042 } // namespace cc | 5027 } // namespace cc |
| OLD | NEW |