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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 class TextureLayerNoExtraCommitForMailboxTest | 1100 class TextureLayerNoExtraCommitForMailboxTest |
1101 : public LayerTreeTest, | 1101 : public LayerTreeTest, |
1102 public TextureLayerClient { | 1102 public TextureLayerClient { |
1103 public: | 1103 public: |
1104 // TextureLayerClient implementation. | 1104 // TextureLayerClient implementation. |
1105 virtual bool PrepareTextureMailbox( | 1105 virtual bool PrepareTextureMailbox( |
1106 TextureMailbox* texture_mailbox, | 1106 TextureMailbox* texture_mailbox, |
1107 scoped_ptr<SingleReleaseCallback>* release_callback, | 1107 scoped_ptr<SingleReleaseCallback>* release_callback, |
1108 bool use_shared_memory) OVERRIDE { | 1108 bool use_shared_memory) OVERRIDE { |
1109 if (layer_tree_host()->source_frame_number() == 1) { | 1109 if (layer_tree_host()->source_frame_number() == 1) { |
| 1110 // Once this has been committed, the mailbox will be released. |
1110 *texture_mailbox = TextureMailbox(); | 1111 *texture_mailbox = TextureMailbox(); |
1111 return true; | 1112 return true; |
1112 } | 1113 } |
1113 | 1114 |
1114 *texture_mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); | 1115 *texture_mailbox = TextureMailbox(MailboxFromChar('1'), GL_TEXTURE_2D, 0); |
1115 *release_callback = SingleReleaseCallback::Create( | 1116 *release_callback = SingleReleaseCallback::Create( |
1116 base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, | 1117 base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, |
1117 base::Unretained(this))); | 1118 base::Unretained(this))); |
1118 return true; | 1119 return true; |
1119 } | 1120 } |
1120 | 1121 |
1121 void MailboxReleased(uint32 sync_point, bool lost_resource) { | 1122 void MailboxReleased(uint32 sync_point, bool lost_resource) { |
1122 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 1123 // Source frame number during callback is the same as the source frame |
| 1124 // on which it was released. |
| 1125 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); |
1123 EndTest(); | 1126 EndTest(); |
1124 } | 1127 } |
1125 | 1128 |
1126 virtual void SetupTree() OVERRIDE { | 1129 virtual void SetupTree() OVERRIDE { |
1127 scoped_refptr<Layer> root = Layer::Create(); | 1130 scoped_refptr<Layer> root = Layer::Create(); |
1128 root->SetBounds(gfx::Size(10, 10)); | 1131 root->SetBounds(gfx::Size(10, 10)); |
1129 root->SetAnchorPoint(gfx::PointF()); | 1132 root->SetAnchorPoint(gfx::PointF()); |
1130 root->SetIsDrawable(true); | 1133 root->SetIsDrawable(true); |
1131 | 1134 |
1132 texture_layer_ = TextureLayer::CreateForMailbox(this); | 1135 texture_layer_ = TextureLayer::CreateForMailbox(this); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 int callback_count_; | 1556 int callback_count_; |
1554 scoped_refptr<Layer> root_; | 1557 scoped_refptr<Layer> root_; |
1555 scoped_refptr<TextureLayer> layer_; | 1558 scoped_refptr<TextureLayer> layer_; |
1556 }; | 1559 }; |
1557 | 1560 |
1558 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1561 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1559 TextureLayerWithMailboxImplThreadDeleted); | 1562 TextureLayerWithMailboxImplThreadDeleted); |
1560 | 1563 |
1561 } // namespace | 1564 } // namespace |
1562 } // namespace cc | 1565 } // namespace cc |
OLD | NEW |