| 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/layers/texture_layer_client.h" | 10 #include "cc/layers/texture_layer_client.h" |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 virtual void BeginTest() OVERRIDE { | 1015 virtual void BeginTest() OVERRIDE { |
| 1016 callback_count_ = 0; | 1016 callback_count_ = 0; |
| 1017 | 1017 |
| 1018 // Set the mailbox on the main thread. | 1018 // Set the mailbox on the main thread. |
| 1019 SetMailbox('1'); | 1019 SetMailbox('1'); |
| 1020 EXPECT_EQ(0, callback_count_); | 1020 EXPECT_EQ(0, callback_count_); |
| 1021 | 1021 |
| 1022 PostSetNeedsCommitToMainThread(); | 1022 PostSetNeedsCommitToMainThread(); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1025 virtual void DidCommit() OVERRIDE { |
| 1026 switch (layer_tree_host()->source_frame_number()) { | 1026 switch (layer_tree_host()->source_frame_number()) { |
| 1027 case 1: | 1027 case 1: |
| 1028 // Delete the TextureLayer on the main thread while the mailbox is in | 1028 // Delete the TextureLayer on the main thread while the mailbox is in |
| 1029 // the impl tree. | 1029 // the impl tree. |
| 1030 layer_->RemoveFromParent(); | 1030 layer_->RemoveFromParent(); |
| 1031 layer_ = NULL; | 1031 layer_ = NULL; |
| 1032 break; | 1032 break; |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 | 1035 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 virtual void BeginTest() OVERRIDE { | 1083 virtual void BeginTest() OVERRIDE { |
| 1084 callback_count_ = 0; | 1084 callback_count_ = 0; |
| 1085 | 1085 |
| 1086 // Set the mailbox on the main thread. | 1086 // Set the mailbox on the main thread. |
| 1087 SetMailbox('1'); | 1087 SetMailbox('1'); |
| 1088 EXPECT_EQ(0, callback_count_); | 1088 EXPECT_EQ(0, callback_count_); |
| 1089 | 1089 |
| 1090 PostSetNeedsCommitToMainThread(); | 1090 PostSetNeedsCommitToMainThread(); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1093 virtual void DidCommit() OVERRIDE { |
| 1094 switch (layer_tree_host()->source_frame_number()) { | 1094 switch (layer_tree_host()->source_frame_number()) { |
| 1095 case 1: | 1095 case 1: |
| 1096 // Remove the TextureLayer on the main thread while the mailbox is in | 1096 // Remove the TextureLayer on the main thread while the mailbox is in |
| 1097 // the impl tree, but don't delete the TextureLayer until after the impl | 1097 // the impl tree, but don't delete the TextureLayer until after the impl |
| 1098 // tree side is deleted. | 1098 // tree side is deleted. |
| 1099 layer_->RemoveFromParent(); | 1099 layer_->RemoveFromParent(); |
| 1100 break; | 1100 break; |
| 1101 case 2: | 1101 case 2: |
| 1102 layer_ = NULL; | 1102 layer_ = NULL; |
| 1103 break; | 1103 break; |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 virtual void AfterTest() OVERRIDE { | 1107 virtual void AfterTest() OVERRIDE { |
| 1108 EXPECT_EQ(1, callback_count_); | 1108 EXPECT_EQ(1, callback_count_); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 private: | 1111 private: |
| 1112 int callback_count_; | 1112 int callback_count_; |
| 1113 scoped_refptr<Layer> root_; | 1113 scoped_refptr<Layer> root_; |
| 1114 scoped_refptr<TextureLayer> layer_; | 1114 scoped_refptr<TextureLayer> layer_; |
| 1115 }; | 1115 }; |
| 1116 | 1116 |
| 1117 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1117 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1118 TextureLayerWithMailboxImplThreadDeleted); | 1118 TextureLayerWithMailboxImplThreadDeleted); |
| 1119 | 1119 |
| 1120 } // namespace | 1120 } // namespace |
| 1121 } // namespace cc | 1121 } // namespace cc |
| OLD | NEW |