OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "cc/base/thread.h" | 10 #include "cc/base/thread.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 break; | 406 break; |
407 case 6: | 407 case 6: |
408 // Old mailbox was released, task was posted, but won't execute | 408 // Old mailbox was released, task was posted, but won't execute |
409 // until this DidCommit returns. | 409 // until this DidCommit returns. |
410 // TODO(piman): fix this. | 410 // TODO(piman): fix this. |
411 EXPECT_EQ(3, callback_count_); | 411 EXPECT_EQ(3, callback_count_); |
412 layer_tree_host()->SetNeedsCommit(); | 412 layer_tree_host()->SetNeedsCommit(); |
413 break; | 413 break; |
414 case 7: | 414 case 7: |
415 EXPECT_EQ(4, callback_count_); | 415 EXPECT_EQ(4, callback_count_); |
| 416 // Restore a mailbox for the next step. |
| 417 SetMailbox('5'); |
| 418 break; |
| 419 case 8: |
| 420 // Case #5: remove layer from tree. Callback should *not* be called, the |
| 421 // mailbox is returned to the main thread. |
| 422 EXPECT_EQ(4, callback_count_); |
| 423 layer_->RemoveFromParent(); |
| 424 break; |
| 425 case 9: |
| 426 // Mailbox was released to the main thread, task was posted, but won't |
| 427 // execute until this DidCommit returns. |
| 428 // TODO(piman): fix this. |
| 429 EXPECT_EQ(4, callback_count_); |
| 430 layer_tree_host()->SetNeedsCommit(); |
| 431 break; |
| 432 case 10: |
| 433 EXPECT_EQ(4, callback_count_); |
| 434 // Resetting the mailbox will call the callback now. |
| 435 layer_->SetTextureMailbox(TextureMailbox()); |
| 436 EXPECT_EQ(5, callback_count_); |
416 EndTest(); | 437 EndTest(); |
417 break; | 438 break; |
418 default: | 439 default: |
419 NOTREACHED(); | 440 NOTREACHED(); |
420 break; | 441 break; |
421 } | 442 } |
422 } | 443 } |
423 | 444 |
424 virtual void AfterTest() OVERRIDE {} | 445 virtual void AfterTest() OVERRIDE {} |
425 | 446 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 base::Lock lock_; | 738 base::Lock lock_; |
718 unsigned expected_used_textures_on_commit_; | 739 unsigned expected_used_textures_on_commit_; |
719 }; | 740 }; |
720 | 741 |
721 // The TextureLayerClient does not use mailboxes, so can't use a delegating | 742 // The TextureLayerClient does not use mailboxes, so can't use a delegating |
722 // renderer. | 743 // renderer. |
723 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerClientTest); | 744 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerClientTest); |
724 | 745 |
725 } // namespace | 746 } // namespace |
726 } // namespace cc | 747 } // namespace cc |
OLD | NEW |