| 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 4427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4438 } | 4438 } |
| 4439 | 4439 |
| 4440 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 4440 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
| 4441 base::AutoLock lock(result_->lock); | 4441 base::AutoLock lock(result_->lock); |
| 4442 EXPECT_FALSE(result_->did_swap_called); | 4442 EXPECT_FALSE(result_->did_swap_called); |
| 4443 EXPECT_FALSE(result_->did_not_swap_called); | 4443 EXPECT_FALSE(result_->did_not_swap_called); |
| 4444 result_->did_not_swap_called = true; | 4444 result_->did_not_swap_called = true; |
| 4445 result_->reason = reason; | 4445 result_->reason = reason; |
| 4446 } | 4446 } |
| 4447 | 4447 |
| 4448 virtual int64 TraceId() const OVERRIDE { return 0; } |
| 4449 |
| 4448 private: | 4450 private: |
| 4449 // Not owned. | 4451 // Not owned. |
| 4450 TestSwapPromiseResult* result_; | 4452 TestSwapPromiseResult* result_; |
| 4451 }; | 4453 }; |
| 4452 | 4454 |
| 4453 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { | 4455 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { |
| 4454 protected: | 4456 protected: |
| 4455 LayerTreeHostTestBreakSwapPromise() | 4457 LayerTreeHostTestBreakSwapPromise() |
| 4456 : commit_count_(0), commit_complete_count_(0) {} | 4458 : commit_count_(0), commit_complete_count_(0) {} |
| 4457 | 4459 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4614 SINGLE_AND_MULTI_THREAD_TEST_F( | 4616 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 4615 LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit); | 4617 LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit); |
| 4616 | 4618 |
| 4617 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 4619 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
| 4618 public: | 4620 public: |
| 4619 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 4621 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
| 4620 LayerTreeHostImpl* layer_tree_host_impl, | 4622 LayerTreeHostImpl* layer_tree_host_impl, |
| 4621 int* set_needs_commit_count, | 4623 int* set_needs_commit_count, |
| 4622 int* set_needs_redraw_count) | 4624 int* set_needs_redraw_count) |
| 4623 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 4625 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
| 4624 set_needs_commit_count_(set_needs_commit_count), | 4626 set_needs_commit_count_(set_needs_commit_count) {} |
| 4625 set_needs_redraw_count_(set_needs_redraw_count) {} | |
| 4626 | 4627 |
| 4627 virtual ~SimpleSwapPromiseMonitor() {} | 4628 virtual ~SimpleSwapPromiseMonitor() {} |
| 4628 | 4629 |
| 4629 virtual void OnSetNeedsCommitOnMain() OVERRIDE { | 4630 virtual void OnSetNeedsCommitOnMain() OVERRIDE { |
| 4630 (*set_needs_commit_count_)++; | 4631 (*set_needs_commit_count_)++; |
| 4631 } | 4632 } |
| 4632 | 4633 |
| 4633 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { | 4634 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { |
| 4634 (*set_needs_redraw_count_)++; | 4635 ADD_FAILURE() << "Should not get called on main thread."; |
| 4636 } |
| 4637 |
| 4638 virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE { |
| 4639 ADD_FAILURE() << "Should not get called on main thread."; |
| 4635 } | 4640 } |
| 4636 | 4641 |
| 4637 private: | 4642 private: |
| 4638 int* set_needs_commit_count_; | 4643 int* set_needs_commit_count_; |
| 4639 int* set_needs_redraw_count_; | |
| 4640 }; | 4644 }; |
| 4641 | 4645 |
| 4642 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { | 4646 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { |
| 4643 public: | 4647 public: |
| 4644 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4648 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 4645 | 4649 |
| 4646 virtual void WillBeginMainFrame() OVERRIDE { | 4650 virtual void WillBeginMainFrame() OVERRIDE { |
| 4647 if (TestEnded()) | 4651 if (TestEnded()) |
| 4648 return; | 4652 return; |
| 4649 | 4653 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5014 const gfx::Size bounds_; | 5018 const gfx::Size bounds_; |
| 5015 FakeContentLayerClient client_; | 5019 FakeContentLayerClient client_; |
| 5016 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5020 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5017 scoped_refptr<FakePictureLayer> picture_layer_; | 5021 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5018 Layer* child_layer_; | 5022 Layer* child_layer_; |
| 5019 }; | 5023 }; |
| 5020 | 5024 |
| 5021 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5025 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5022 | 5026 |
| 5023 } // namespace cc | 5027 } // namespace cc |
| OLD | NEW |