| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 root->SetBounds(gfx::Rect(0, 0, 10, 10)); | 1149 root->SetBounds(gfx::Rect(0, 0, 10, 10)); |
| 1150 root->SetVisible(true); | 1150 root->SetVisible(true); |
| 1151 WaitForCommit(); | 1151 WaitForCommit(); |
| 1152 | 1152 |
| 1153 gfx::Rect damaged_rect(0, 0, 5, 5); | 1153 gfx::Rect damaged_rect(0, 0, 5, 5); |
| 1154 root->SchedulePaint(damaged_rect); | 1154 root->SchedulePaint(damaged_rect); |
| 1155 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); | 1155 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); |
| 1156 WaitForCommit(); | 1156 WaitForCommit(); |
| 1157 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); | 1157 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); |
| 1158 | 1158 |
| 1159 // The texture mailbox has a reference from an in-flight texture layer. | 1159 compositor()->SetRootLayer(nullptr); |
| 1160 // We clear the texture mailbox from the root layer and draw a new frame | 1160 root.reset(); |
| 1161 // to ensure that the texture mailbox is released. We then draw a second | 1161 WaitForCommit(); |
| 1162 // frame to ensure that the mailbox's release callback has time to run. | |
| 1163 root->SetShowSolidColorContent(); | |
| 1164 Draw(); | |
| 1165 Draw(); | |
| 1166 } | 1162 } |
| 1167 | 1163 |
| 1168 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { | 1164 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { |
| 1169 EXPECT_EQ(expected_color, actual_color) | 1165 EXPECT_EQ(expected_color, actual_color) |
| 1170 << "Pixel error at x=" << x << " y=" << y << "; " | 1166 << "Pixel error at x=" << x << " y=" << y << "; " |
| 1171 << "actual RGBA=(" | 1167 << "actual RGBA=(" |
| 1172 << SkColorGetR(actual_color) << "," | 1168 << SkColorGetR(actual_color) << "," |
| 1173 << SkColorGetG(actual_color) << "," | 1169 << SkColorGetG(actual_color) << "," |
| 1174 << SkColorGetB(actual_color) << "," | 1170 << SkColorGetB(actual_color) << "," |
| 1175 << SkColorGetA(actual_color) << "); " | 1171 << SkColorGetA(actual_color) << "); " |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 layer.set_name("foo"); | 2277 layer.set_name("foo"); |
| 2282 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2278 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
| 2283 layer.TakeDebugInfo(nullptr); | 2279 layer.TakeDebugInfo(nullptr); |
| 2284 std::string trace_format("bar,"); | 2280 std::string trace_format("bar,"); |
| 2285 debug_info->AppendAsTraceFormat(&trace_format); | 2281 debug_info->AppendAsTraceFormat(&trace_format); |
| 2286 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2282 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
| 2287 EXPECT_EQ(expected, trace_format); | 2283 EXPECT_EQ(expected, trace_format); |
| 2288 } | 2284 } |
| 2289 | 2285 |
| 2290 } // namespace ui | 2286 } // namespace ui |
| OLD | NEW |