| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 root->SetBounds(gfx::Rect(0, 0, 10, 10)); | 1140 root->SetBounds(gfx::Rect(0, 0, 10, 10)); |
| 1141 root->SetVisible(true); | 1141 root->SetVisible(true); |
| 1142 WaitForCommit(); | 1142 WaitForCommit(); |
| 1143 | 1143 |
| 1144 gfx::Rect damaged_rect(0, 0, 5, 5); | 1144 gfx::Rect damaged_rect(0, 0, 5, 5); |
| 1145 root->SchedulePaint(damaged_rect); | 1145 root->SchedulePaint(damaged_rect); |
| 1146 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); | 1146 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); |
| 1147 WaitForCommit(); | 1147 WaitForCommit(); |
| 1148 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); | 1148 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); |
| 1149 | 1149 |
| 1150 compositor()->SetRootLayer(nullptr); | 1150 // The texture mailbox has a reference from an in-flight texture layer. |
| 1151 root.reset(); | 1151 // We clear the texture mailbox from the root layer and draw a new frame |
| 1152 WaitForCommit(); | 1152 // to ensure that the texture mailbox is released. We then draw a second |
| 1153 // frame to ensure that the mailbox's release callback has time to run. |
| 1154 root->SetShowSolidColorContent(); |
| 1155 Draw(); |
| 1156 Draw(); |
| 1153 } | 1157 } |
| 1154 | 1158 |
| 1155 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { | 1159 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { |
| 1156 EXPECT_EQ(expected_color, actual_color) | 1160 EXPECT_EQ(expected_color, actual_color) |
| 1157 << "Pixel error at x=" << x << " y=" << y << "; " | 1161 << "Pixel error at x=" << x << " y=" << y << "; " |
| 1158 << "actual RGBA=(" | 1162 << "actual RGBA=(" |
| 1159 << SkColorGetR(actual_color) << "," | 1163 << SkColorGetR(actual_color) << "," |
| 1160 << SkColorGetG(actual_color) << "," | 1164 << SkColorGetG(actual_color) << "," |
| 1161 << SkColorGetB(actual_color) << "," | 1165 << SkColorGetB(actual_color) << "," |
| 1162 << SkColorGetA(actual_color) << "); " | 1166 << SkColorGetA(actual_color) << "); " |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 layer.set_name("foo"); | 2237 layer.set_name("foo"); |
| 2234 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2238 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
| 2235 layer.TakeDebugInfo(nullptr); | 2239 layer.TakeDebugInfo(nullptr); |
| 2236 std::string trace_format("bar,"); | 2240 std::string trace_format("bar,"); |
| 2237 debug_info->AppendAsTraceFormat(&trace_format); | 2241 debug_info->AppendAsTraceFormat(&trace_format); |
| 2238 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2242 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
| 2239 EXPECT_EQ(expected, trace_format); | 2243 EXPECT_EQ(expected, trace_format); |
| 2240 } | 2244 } |
| 2241 | 2245 |
| 2242 } // namespace ui | 2246 } // namespace ui |
| OLD | NEW |