| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1169 |
| 1170 TextureMailbox MakeMailbox(char name) { | 1170 TextureMailbox MakeMailbox(char name) { |
| 1171 return TextureMailbox(MailboxFromChar(name), | 1171 return TextureMailbox(MailboxFromChar(name), |
| 1172 SyncTokenFromUInt(static_cast<uint32_t>(name)), | 1172 SyncTokenFromUInt(static_cast<uint32_t>(name)), |
| 1173 GL_TEXTURE_2D); | 1173 GL_TEXTURE_2D); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 void MailboxReleased(const gpu::SyncToken& sync_token, bool lost_resource) { | 1176 void MailboxReleased(const gpu::SyncToken& sync_token, bool lost_resource) { |
| 1177 EXPECT_TRUE(sync_token.HasData()); | 1177 EXPECT_TRUE(sync_token.HasData()); |
| 1178 ++mailbox_returned_; | 1178 ++mailbox_returned_; |
| 1179 switch (mailbox_returned_) { | |
| 1180 case 1: | |
| 1181 break; | |
| 1182 case 2: | |
| 1183 EXPECT_EQ(commit_count_, 5); | |
| 1184 EndTest(); | |
| 1185 break; | |
| 1186 default: | |
| 1187 NOTREACHED(); | |
| 1188 } | |
| 1189 } | 1179 } |
| 1190 | 1180 |
| 1191 void SetupTree() override { | 1181 void SetupTree() override { |
| 1192 scoped_refptr<Layer> root = Layer::Create(); | 1182 scoped_refptr<Layer> root = Layer::Create(); |
| 1193 root->SetBounds(gfx::Size(10, 10)); | 1183 root->SetBounds(gfx::Size(10, 10)); |
| 1194 root->SetIsDrawable(true); | 1184 root->SetIsDrawable(true); |
| 1195 | 1185 |
| 1196 solid_layer_ = SolidColorLayer::Create(); | 1186 solid_layer_ = SolidColorLayer::Create(); |
| 1197 solid_layer_->SetBounds(gfx::Size(10, 10)); | 1187 solid_layer_->SetBounds(gfx::Size(10, 10)); |
| 1198 solid_layer_->SetIsDrawable(true); | 1188 solid_layer_->SetIsDrawable(true); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 parent_layer_->SetOpacity(0.9f); | 1233 parent_layer_->SetOpacity(0.9f); |
| 1244 break; | 1234 break; |
| 1245 case 4: | 1235 case 4: |
| 1246 // Layer should have been updated. | 1236 // Layer should have been updated. |
| 1247 EXPECT_EQ(2, prepare_called_); | 1237 EXPECT_EQ(2, prepare_called_); |
| 1248 // So the old mailbox should have been returned already. | 1238 // So the old mailbox should have been returned already. |
| 1249 EXPECT_EQ(1, mailbox_returned_); | 1239 EXPECT_EQ(1, mailbox_returned_); |
| 1250 texture_layer_->ClearClient(); | 1240 texture_layer_->ClearClient(); |
| 1251 break; | 1241 break; |
| 1252 case 5: | 1242 case 5: |
| 1243 EXPECT_EQ(2, mailbox_returned_); |
| 1244 EndTest(); |
| 1253 break; | 1245 break; |
| 1254 default: | 1246 default: |
| 1255 NOTREACHED(); | 1247 NOTREACHED(); |
| 1256 break; | 1248 break; |
| 1257 } | 1249 } |
| 1258 } | 1250 } |
| 1259 | 1251 |
| 1260 void AfterTest() override {} | 1252 void AfterTest() override {} |
| 1261 | 1253 |
| 1262 private: | 1254 private: |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 base::ThreadChecker main_thread_; | 1476 base::ThreadChecker main_thread_; |
| 1485 int callback_count_; | 1477 int callback_count_; |
| 1486 scoped_refptr<Layer> root_; | 1478 scoped_refptr<Layer> root_; |
| 1487 scoped_refptr<TextureLayer> layer_; | 1479 scoped_refptr<TextureLayer> layer_; |
| 1488 }; | 1480 }; |
| 1489 | 1481 |
| 1490 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); | 1482 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); |
| 1491 | 1483 |
| 1492 } // namespace | 1484 } // namespace |
| 1493 } // namespace cc | 1485 } // namespace cc |
| OLD | NEW |