| 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 4442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 } | 4453 } |
| 4454 | 4454 |
| 4455 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 4455 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
| 4456 base::AutoLock lock(result_->lock); | 4456 base::AutoLock lock(result_->lock); |
| 4457 EXPECT_FALSE(result_->did_swap_called); | 4457 EXPECT_FALSE(result_->did_swap_called); |
| 4458 EXPECT_FALSE(result_->did_not_swap_called); | 4458 EXPECT_FALSE(result_->did_not_swap_called); |
| 4459 result_->did_not_swap_called = true; | 4459 result_->did_not_swap_called = true; |
| 4460 result_->reason = reason; | 4460 result_->reason = reason; |
| 4461 } | 4461 } |
| 4462 | 4462 |
| 4463 virtual int64 TraceId() const OVERRIDE { return 0; } | |
| 4464 | |
| 4465 private: | 4463 private: |
| 4466 // Not owned. | 4464 // Not owned. |
| 4467 TestSwapPromiseResult* result_; | 4465 TestSwapPromiseResult* result_; |
| 4468 }; | 4466 }; |
| 4469 | 4467 |
| 4470 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { | 4468 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { |
| 4471 protected: | 4469 protected: |
| 4472 LayerTreeHostTestBreakSwapPromise() | 4470 LayerTreeHostTestBreakSwapPromise() |
| 4473 : commit_count_(0), commit_complete_count_(0) {} | 4471 : commit_count_(0), commit_complete_count_(0) {} |
| 4474 | 4472 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4585 | 4583 |
| 4586 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForAbortedCommit); | 4584 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForAbortedCommit); |
| 4587 | 4585 |
| 4588 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 4586 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
| 4589 public: | 4587 public: |
| 4590 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 4588 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
| 4591 LayerTreeHostImpl* layer_tree_host_impl, | 4589 LayerTreeHostImpl* layer_tree_host_impl, |
| 4592 int* set_needs_commit_count, | 4590 int* set_needs_commit_count, |
| 4593 int* set_needs_redraw_count) | 4591 int* set_needs_redraw_count) |
| 4594 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 4592 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
| 4595 set_needs_commit_count_(set_needs_commit_count) {} | 4593 set_needs_commit_count_(set_needs_commit_count), |
| 4594 set_needs_redraw_count_(set_needs_redraw_count) {} |
| 4596 | 4595 |
| 4597 virtual ~SimpleSwapPromiseMonitor() {} | 4596 virtual ~SimpleSwapPromiseMonitor() {} |
| 4598 | 4597 |
| 4599 virtual void OnSetNeedsCommitOnMain() OVERRIDE { | 4598 virtual void OnSetNeedsCommitOnMain() OVERRIDE { |
| 4600 (*set_needs_commit_count_)++; | 4599 (*set_needs_commit_count_)++; |
| 4601 } | 4600 } |
| 4602 | 4601 |
| 4603 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { | 4602 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { |
| 4604 ADD_FAILURE() << "Should not get called on main thread."; | 4603 (*set_needs_redraw_count_)++; |
| 4605 } | |
| 4606 | |
| 4607 virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE { | |
| 4608 ADD_FAILURE() << "Should not get called on main thread."; | |
| 4609 } | 4604 } |
| 4610 | 4605 |
| 4611 private: | 4606 private: |
| 4612 int* set_needs_commit_count_; | 4607 int* set_needs_commit_count_; |
| 4608 int* set_needs_redraw_count_; |
| 4613 }; | 4609 }; |
| 4614 | 4610 |
| 4615 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { | 4611 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { |
| 4616 public: | 4612 public: |
| 4617 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4613 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 4618 | 4614 |
| 4619 virtual void WillBeginMainFrame() OVERRIDE { | 4615 virtual void WillBeginMainFrame() OVERRIDE { |
| 4620 int set_needs_commit_count = 0; | 4616 int set_needs_commit_count = 0; |
| 4621 int set_needs_redraw_count = 0; | 4617 int set_needs_redraw_count = 0; |
| 4622 | 4618 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4971 const gfx::Size bounds_; | 4967 const gfx::Size bounds_; |
| 4972 FakeContentLayerClient client_; | 4968 FakeContentLayerClient client_; |
| 4973 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4969 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 4974 scoped_refptr<FakePictureLayer> picture_layer_; | 4970 scoped_refptr<FakePictureLayer> picture_layer_; |
| 4975 Layer* child_layer_; | 4971 Layer* child_layer_; |
| 4976 }; | 4972 }; |
| 4977 | 4973 |
| 4978 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4974 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 4979 | 4975 |
| 4980 } // namespace cc | 4976 } // namespace cc |
| OLD | NEW |