| 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 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4425 } | 4425 } |
| 4426 | 4426 |
| 4427 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 4427 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
| 4428 base::AutoLock lock(result_->lock); | 4428 base::AutoLock lock(result_->lock); |
| 4429 EXPECT_FALSE(result_->did_swap_called); | 4429 EXPECT_FALSE(result_->did_swap_called); |
| 4430 EXPECT_FALSE(result_->did_not_swap_called); | 4430 EXPECT_FALSE(result_->did_not_swap_called); |
| 4431 result_->did_not_swap_called = true; | 4431 result_->did_not_swap_called = true; |
| 4432 result_->reason = reason; | 4432 result_->reason = reason; |
| 4433 } | 4433 } |
| 4434 | 4434 |
| 4435 virtual int64 TraceId() const OVERRIDE { return 0; } | |
| 4436 | |
| 4437 private: | 4435 private: |
| 4438 // Not owned. | 4436 // Not owned. |
| 4439 TestSwapPromiseResult* result_; | 4437 TestSwapPromiseResult* result_; |
| 4440 }; | 4438 }; |
| 4441 | 4439 |
| 4442 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { | 4440 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { |
| 4443 protected: | 4441 protected: |
| 4444 LayerTreeHostTestBreakSwapPromise() | 4442 LayerTreeHostTestBreakSwapPromise() |
| 4445 : commit_count_(0), commit_complete_count_(0) {} | 4443 : commit_count_(0), commit_complete_count_(0) {} |
| 4446 | 4444 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4513 // TODO(miletus): Flaky test: crbug.com/393995 | 4511 // TODO(miletus): Flaky test: crbug.com/393995 |
| 4514 // MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4512 // MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
| 4515 | 4513 |
| 4516 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 4514 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
| 4517 public: | 4515 public: |
| 4518 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 4516 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
| 4519 LayerTreeHostImpl* layer_tree_host_impl, | 4517 LayerTreeHostImpl* layer_tree_host_impl, |
| 4520 int* set_needs_commit_count, | 4518 int* set_needs_commit_count, |
| 4521 int* set_needs_redraw_count) | 4519 int* set_needs_redraw_count) |
| 4522 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 4520 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
| 4523 set_needs_commit_count_(set_needs_commit_count) {} | 4521 set_needs_commit_count_(set_needs_commit_count), |
| 4522 set_needs_redraw_count_(set_needs_redraw_count) {} |
| 4524 | 4523 |
| 4525 virtual ~SimpleSwapPromiseMonitor() {} | 4524 virtual ~SimpleSwapPromiseMonitor() {} |
| 4526 | 4525 |
| 4527 virtual void OnSetNeedsCommitOnMain() OVERRIDE { | 4526 virtual void OnSetNeedsCommitOnMain() OVERRIDE { |
| 4528 (*set_needs_commit_count_)++; | 4527 (*set_needs_commit_count_)++; |
| 4529 } | 4528 } |
| 4530 | 4529 |
| 4531 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { | 4530 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { |
| 4532 ADD_FAILURE() << "Should not get called on main thread."; | 4531 (*set_needs_redraw_count_)++; |
| 4533 } | |
| 4534 | |
| 4535 virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE { | |
| 4536 ADD_FAILURE() << "Should not get called on main thread."; | |
| 4537 } | 4532 } |
| 4538 | 4533 |
| 4539 private: | 4534 private: |
| 4540 int* set_needs_commit_count_; | 4535 int* set_needs_commit_count_; |
| 4536 int* set_needs_redraw_count_; |
| 4541 }; | 4537 }; |
| 4542 | 4538 |
| 4543 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { | 4539 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { |
| 4544 public: | 4540 public: |
| 4545 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4541 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 4546 | 4542 |
| 4547 virtual void WillBeginMainFrame() OVERRIDE { | 4543 virtual void WillBeginMainFrame() OVERRIDE { |
| 4548 int set_needs_commit_count = 0; | 4544 int set_needs_commit_count = 0; |
| 4549 int set_needs_redraw_count = 0; | 4545 int set_needs_redraw_count = 0; |
| 4550 | 4546 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4899 const gfx::Size bounds_; | 4895 const gfx::Size bounds_; |
| 4900 FakeContentLayerClient client_; | 4896 FakeContentLayerClient client_; |
| 4901 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4897 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 4902 scoped_refptr<FakePictureLayer> picture_layer_; | 4898 scoped_refptr<FakePictureLayer> picture_layer_; |
| 4903 Layer* child_layer_; | 4899 Layer* child_layer_; |
| 4904 }; | 4900 }; |
| 4905 | 4901 |
| 4906 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4902 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 4907 | 4903 |
| 4908 } // namespace cc | 4904 } // namespace cc |
| OLD | NEW |