Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2822143003: Remove ForceReclaimResources (Closed)
Patch Set: Rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/layouttest_support.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 root->SetBounds(gfx::Rect(0, 0, 10, 10)); 1132 root->SetBounds(gfx::Rect(0, 0, 10, 10));
1133 root->SetVisible(true); 1133 root->SetVisible(true);
1134 WaitForCommit(); 1134 WaitForCommit();
1135 1135
1136 gfx::Rect damaged_rect(0, 0, 5, 5); 1136 gfx::Rect damaged_rect(0, 0, 5, 5);
1137 root->SchedulePaint(damaged_rect); 1137 root->SchedulePaint(damaged_rect);
1138 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); 1138 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds());
1139 WaitForCommit(); 1139 WaitForCommit();
1140 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); 1140 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty());
1141 1141
1142 compositor()->SetRootLayer(nullptr); 1142 // The texture mailbox has a reference from an in-flight texture layer.
ericrk 2017/04/24 22:24:08 Thanks for the fix!
1143 root.reset(); 1143 // We clear the texture mailbox from the root layer and draw a new frame
1144 // to ensure that the texture mailbox is released. We then draw a second
1145 // frame to ensure that the mailbox's release callback has time to run.
danakj 2017/04/25 14:20:42 Oh but you could also do fwiw.. make a RunLoop, a
kylechar 2017/04/25 16:25:01 How does this look?
1146 root->SetShowSolidColorContent();
1147 compositor()->ScheduleDraw();
1148 WaitForCommit();
1149 compositor()->ScheduleDraw();
1144 WaitForCommit(); 1150 WaitForCommit();
1145 } 1151 }
1146 1152
1147 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { 1153 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) {
1148 EXPECT_EQ(expected_color, actual_color) 1154 EXPECT_EQ(expected_color, actual_color)
1149 << "Pixel error at x=" << x << " y=" << y << "; " 1155 << "Pixel error at x=" << x << " y=" << y << "; "
1150 << "actual RGBA=(" 1156 << "actual RGBA=("
1151 << SkColorGetR(actual_color) << "," 1157 << SkColorGetR(actual_color) << ","
1152 << SkColorGetG(actual_color) << "," 1158 << SkColorGetG(actual_color) << ","
1153 << SkColorGetB(actual_color) << "," 1159 << SkColorGetB(actual_color) << ","
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 layer.set_name("foo"); 2244 layer.set_name("foo");
2239 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2245 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2240 layer.TakeDebugInfo(nullptr); 2246 layer.TakeDebugInfo(nullptr);
2241 std::string trace_format("bar,"); 2247 std::string trace_format("bar,");
2242 debug_info->AppendAsTraceFormat(&trace_format); 2248 debug_info->AppendAsTraceFormat(&trace_format);
2243 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2249 std::string expected("bar,{\"layer_name\":\"foo\"}");
2244 EXPECT_EQ(expected, trace_format); 2250 EXPECT_EQ(expected, trace_format);
2245 } 2251 }
2246 2252
2247 } // namespace ui 2253 } // namespace ui
OLDNEW
« no previous file with comments | « content/test/layouttest_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698