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 5215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5226 bool did_swap_called; | 5226 bool did_swap_called; |
5227 bool did_not_swap_called; | 5227 bool did_not_swap_called; |
5228 bool dtor_called; | 5228 bool dtor_called; |
5229 SwapPromise::DidNotSwapReason reason; | 5229 SwapPromise::DidNotSwapReason reason; |
5230 base::Lock lock; | 5230 base::Lock lock; |
5231 }; | 5231 }; |
5232 | 5232 |
5233 class TestSwapPromise : public SwapPromise { | 5233 class TestSwapPromise : public SwapPromise { |
5234 public: | 5234 public: |
5235 explicit TestSwapPromise(TestSwapPromiseResult* result) | 5235 explicit TestSwapPromise(TestSwapPromiseResult* result) |
5236 : result_(result) { | 5236 : SwapPromise(SWAP_PROMISE_UNKNOWN), |
| 5237 result_(result) { |
5237 } | 5238 } |
5238 | 5239 |
5239 virtual ~TestSwapPromise() { | 5240 virtual ~TestSwapPromise() { |
5240 base::AutoLock lock(result_->lock); | 5241 base::AutoLock lock(result_->lock); |
5241 result_->dtor_called = true; | 5242 result_->dtor_called = true; |
5242 } | 5243 } |
5243 | 5244 |
5244 virtual void DidSwap() OVERRIDE { | 5245 virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE { |
5245 base::AutoLock lock(result_->lock); | 5246 base::AutoLock lock(result_->lock); |
5246 EXPECT_FALSE(result_->did_swap_called); | 5247 EXPECT_FALSE(result_->did_swap_called); |
5247 EXPECT_FALSE(result_->did_not_swap_called); | 5248 EXPECT_FALSE(result_->did_not_swap_called); |
5248 result_->did_swap_called = true; | 5249 result_->did_swap_called = true; |
5249 } | 5250 } |
5250 | 5251 |
5251 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 5252 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
5252 base::AutoLock lock(result_->lock); | 5253 base::AutoLock lock(result_->lock); |
5253 EXPECT_FALSE(result_->did_swap_called); | 5254 EXPECT_FALSE(result_->did_swap_called); |
5254 EXPECT_FALSE(result_->did_not_swap_called); | 5255 EXPECT_FALSE(result_->did_not_swap_called); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5330 } | 5331 } |
5331 | 5332 |
5332 int commit_count_; | 5333 int commit_count_; |
5333 int commit_complete_count_; | 5334 int commit_complete_count_; |
5334 TestSwapPromiseResult swap_promise_result_[3]; | 5335 TestSwapPromiseResult swap_promise_result_[3]; |
5335 }; | 5336 }; |
5336 | 5337 |
5337 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 5338 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
5338 | 5339 |
5339 } // namespace cc | 5340 } // namespace cc |
OLD | NEW |