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 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 | 4510 |
4511 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4511 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
4512 | 4512 |
4513 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 4513 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
4514 public: | 4514 public: |
4515 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 4515 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
4516 LayerTreeHostImpl* layer_tree_host_impl, | 4516 LayerTreeHostImpl* layer_tree_host_impl, |
4517 int* set_needs_commit_count, | 4517 int* set_needs_commit_count, |
4518 int* set_needs_redraw_count) | 4518 int* set_needs_redraw_count) |
4519 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), | 4519 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), |
4520 set_needs_commit_count_(set_needs_commit_count), | 4520 set_needs_commit_count_(set_needs_commit_count) {} |
4521 set_needs_redraw_count_(set_needs_redraw_count) {} | |
4522 | 4521 |
4523 virtual ~SimpleSwapPromiseMonitor() {} | 4522 virtual ~SimpleSwapPromiseMonitor() {} |
4524 | 4523 |
4525 virtual void OnSetNeedsCommitOnMain() OVERRIDE { | 4524 virtual void OnSetNeedsCommitOnMain() OVERRIDE { |
4526 (*set_needs_commit_count_)++; | 4525 (*set_needs_commit_count_)++; |
4527 } | 4526 } |
4528 | 4527 |
4529 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { | 4528 virtual void OnSetNeedsRedrawOnImpl() OVERRIDE { |
4530 (*set_needs_redraw_count_)++; | 4529 ADD_FAILURE() << "Should not get called on main thread."; |
| 4530 } |
| 4531 |
| 4532 virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE { |
| 4533 ADD_FAILURE() << "Should not get called on main thread."; |
4531 } | 4534 } |
4532 | 4535 |
4533 private: | 4536 private: |
4534 int* set_needs_commit_count_; | 4537 int* set_needs_commit_count_; |
4535 int* set_needs_redraw_count_; | |
4536 }; | 4538 }; |
4537 | 4539 |
4538 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { | 4540 class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest { |
4539 public: | 4541 public: |
4540 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4542 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
4541 | 4543 |
4542 virtual void WillBeginMainFrame() OVERRIDE { | 4544 virtual void WillBeginMainFrame() OVERRIDE { |
4543 int set_needs_commit_count = 0; | 4545 int set_needs_commit_count = 0; |
4544 int set_needs_redraw_count = 0; | 4546 int set_needs_redraw_count = 0; |
4545 | 4547 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4894 const gfx::Size bounds_; | 4896 const gfx::Size bounds_; |
4895 FakeContentLayerClient client_; | 4897 FakeContentLayerClient client_; |
4896 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4898 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
4897 scoped_refptr<FakePictureLayer> picture_layer_; | 4899 scoped_refptr<FakePictureLayer> picture_layer_; |
4898 Layer* child_layer_; | 4900 Layer* child_layer_; |
4899 }; | 4901 }; |
4900 | 4902 |
4901 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4903 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
4902 | 4904 |
4903 } // namespace cc | 4905 } // namespace cc |
OLD | NEW |